diff --git a/.env.example b/.env.example index 71308be..b27c833 100644 --- a/.env.example +++ b/.env.example @@ -2,13 +2,8 @@ SUPERFLUID_RPC_HOST= # Testnet RPCs -ARBITRUM_GOERLI_RPC_URL= AVALANCHE_FUJI_RPC_URL= -BASE_GOERLI_RPC_URL= -GOERLI_RPC_URL= -OPTIMISM_GOERLI_RPC_URL= POLYGON_MUMBAI_RPC_URL= -POLYGON_ZKEVM_RPC_URL= SEPOLIA_RPC_URL= RPC_FORK_URL= diff --git a/deployments/arbitrum-goerli/.chainId b/deployments/arbitrum-goerli/.chainId deleted file mode 100644 index 16be23a..0000000 --- a/deployments/arbitrum-goerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -421613 \ No newline at end of file diff --git a/deployments/arbitrum-goerli/ExistentialNFT.json b/deployments/arbitrum-goerli/ExistentialNFT.json deleted file mode 100644 index 0c8600e..0000000 --- a/deployments/arbitrum-goerli/ExistentialNFT.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "address": "0xDa647B4e1432A6d27B99e06D96FE5dFd42BC7a63", - "abi": [ - { - "inputs": [], - "name": "ExistentialNFT_PaymentOptionIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "ExistentialNFT_TransferIsNotAllowed", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "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": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "name": "addPaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getPaymentOptionFor", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption", - "name": "result", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPaymentOptions", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_baseURI", - "type": "string" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "flowLastUpdated", - "type": "uint256" - } - ], - "name": "isDeprecated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "removePaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "setDeprecatedAfter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "tokenOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xe8157bed76ab6b3df2368f0d65865ab149b1c375e09a6d8ce729d86671e700d0", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0xDa647B4e1432A6d27B99e06D96FE5dFd42BC7a63", - "transactionIndex": 1, - "gasUsed": "3736192", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2963e23c151d39174807014edcbc195c00c13dc35ffd990ea98537450e18efc4", - "transactionHash": "0xe8157bed76ab6b3df2368f0d65865ab149b1c375e09a6d8ce729d86671e700d0", - "logs": [], - "blockNumber": 40925603, - "cumulativeGasUsed": "3736192", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ExistentialNFT_PaymentOptionIndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExistentialNFT_TransferIsNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"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\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"name\":\"addPaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"getPaymentOptionFor\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption\",\"name\":\"result\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPaymentOptions\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_baseURI\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"flowLastUpdated\",\"type\":\"uint256\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removePaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"setDeprecatedAfter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"tokenOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Superfluid Finance\",\"details\":\"Mirrors the Superfluid Checkout-Builder interface\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"}},\"kind\":\"dev\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"params\":{\"incomingFlowToken\":\"- the address of the supertoken\",\"recipient\":\"- the address of the recipient\",\"requiredFlowRate\":\"- the required flow rate\"}},\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\",\"returns\":{\"_0\":\"1 if the owner has a positive flow rate, 0 otherwise\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getPaymentOptionFor(address)\":{\"details\":\"@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\",\"params\":{\"owner\":\"- the address of the owner\",\"result\":\", the loop is not broken, so that the last match is returned.\"},\"returns\":{\"result\":\"PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\"}},\"getPaymentOptions()\":{\"returns\":{\"_0\":\"PaymentOption[] - all configured PaymentOptions\"}},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"details\":\"Array parameters should be the same size.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"@param owner - if they have a positive flow rate, otherwise zero address\"}},\"removePaymentOption(uint256)\":{\"params\":{\"index\":\"- the index of the PaymentOption to be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setDeprecatedAfter(uint256)\":{\"details\":\"only the recipient of the first PaymentOption can call this function\",\"params\":{\"timestamp\":\"- the timestamp after which subscriptions are deprecated\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenOf(address)\":{\"details\":\"one address can own only one token\",\"params\":{\"owner\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\"}},\"tokenURI(uint256)\":{\"details\":\"See {IERC721-tokenURI}.\",\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenURI - the tokenURI for the owner\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"notice\":\"add a new PaymentOption\"},\"balanceOf(address)\":{\"notice\":\"Overridden balanceOf, returning a value depending on the flow rate of the owner\"},\"getPaymentOptionFor(address)\":{\"notice\":\"match the owner to a PaymentOption\"},\"getPaymentOptions()\":{\"notice\":\"get all configured PaymentOptions\"},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"notice\":\"Initializes the contract setting the given PaymentOptions\"},\"isDeprecated(uint256)\":{\"notice\":\"Check if the flow is considered deprecated based on the lastUpdated value\"},\"ownerOf(uint256)\":{\"notice\":\"Overridden ownerOf, determines the owner, depending flow rate\"},\"removePaymentOption(uint256)\":{\"notice\":\"remove an existing PaymentOption\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"This NFT is not transferable\"},\"setDeprecatedAfter(uint256)\":{\"notice\":\"set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated\"},\"tokenOf(address)\":{\"notice\":\"get the tokenId for an owner\"},\"tokenURI(uint256)\":{\"notice\":\"Overridden tokenURI, returning the URI set at deployment\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"}},\"notice\":\"Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFT.sol\":\"ExistentialNFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506142e3806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "devdoc": { - "author": "Superfluid Finance", - "details": "Mirrors the Superfluid Checkout-Builder interface", - "events": { - "Approval(address,address,uint256)": { - "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." - }, - "ApprovalForAll(address,address,bool)": { - "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." - }, - "Initialized(uint8)": { - "details": "Triggered when the contract has been initialized or reinitialized." - }, - "Transfer(address,address,uint256)": { - "details": "Emitted when `tokenId` token is transferred from `from` to `to`." - } - }, - "kind": "dev", - "methods": { - "addPaymentOption(address,address,int96)": { - "params": { - "incomingFlowToken": "- the address of the supertoken", - "recipient": "- the address of the recipient", - "requiredFlowRate": "- the required flow rate" - } - }, - "approve(address,uint256)": { - "details": "See {IERC721-approve}." - }, - "balanceOf(address)": { - "details": "See {IERC721-balanceOf}.", - "returns": { - "_0": "1 if the owner has a positive flow rate, 0 otherwise" - } - }, - "getApproved(uint256)": { - "details": "See {IERC721-getApproved}." - }, - "getPaymentOptionFor(address)": { - "details": "@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned", - "params": { - "owner": "- the address of the owner", - "result": ", the loop is not broken, so that the last match is returned." - }, - "returns": { - "result": "PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption" - } - }, - "getPaymentOptions()": { - "returns": { - "_0": "PaymentOption[] - all configured PaymentOptions" - } - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "details": "Array parameters should be the same size." - }, - "isApprovedForAll(address,address)": { - "details": "See {IERC721-isApprovedForAll}." - }, - "name()": { - "details": "See {IERC721Metadata-name}." - }, - "owner()": { - "details": "Returns the address of the current owner." - }, - "ownerOf(uint256)": { - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "@param owner - if they have a positive flow rate, otherwise zero address" - } - }, - "removePaymentOption(uint256)": { - "params": { - "index": "- the index of the PaymentOption to be removed" - } - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "safeTransferFrom(address,address,uint256)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "setApprovalForAll(address,bool)": { - "details": "See {IERC721-setApprovalForAll}." - }, - "setDeprecatedAfter(uint256)": { - "details": "only the recipient of the first PaymentOption can call this function", - "params": { - "timestamp": "- the timestamp after which subscriptions are deprecated" - } - }, - "supportsInterface(bytes4)": { - "details": "See {IERC165-supportsInterface}." - }, - "symbol()": { - "details": "See {IERC721Metadata-symbol}." - }, - "tokenOf(address)": { - "details": "one address can own only one token", - "params": { - "owner": "- is the address of the owner" - }, - "returns": { - "_0": "tokenId - the address converted to uint256, 0 if the owner has no positive flow rate" - } - }, - "tokenURI(uint256)": { - "details": "See {IERC721-tokenURI}.", - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "tokenURI - the tokenURI for the owner" - } - }, - "transferFrom(address,address,uint256)": { - "details": "See {IERC721-transferFrom}." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "addPaymentOption(address,address,int96)": { - "notice": "add a new PaymentOption" - }, - "balanceOf(address)": { - "notice": "Overridden balanceOf, returning a value depending on the flow rate of the owner" - }, - "getPaymentOptionFor(address)": { - "notice": "match the owner to a PaymentOption" - }, - "getPaymentOptions()": { - "notice": "get all configured PaymentOptions" - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "notice": "Initializes the contract setting the given PaymentOptions" - }, - "isDeprecated(uint256)": { - "notice": "Check if the flow is considered deprecated based on the lastUpdated value" - }, - "ownerOf(uint256)": { - "notice": "Overridden ownerOf, determines the owner, depending flow rate" - }, - "removePaymentOption(uint256)": { - "notice": "remove an existing PaymentOption" - }, - "safeTransferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "This NFT is not transferable" - }, - "setDeprecatedAfter(uint256)": { - "notice": "set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated" - }, - "tokenOf(address)": { - "notice": "get the tokenId for an owner" - }, - "tokenURI(uint256)": { - "notice": "Overridden tokenURI, returning the URI set at deployment" - }, - "transferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - } - }, - "notice": "Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 138, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 1784, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 2057, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "51", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 329, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_name", - "offset": 0, - "slot": "101", - "type": "t_string_storage" - }, - { - "astId": 331, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_symbol", - "offset": 0, - "slot": "102", - "type": "t_string_storage" - }, - { - "astId": 335, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owners", - "offset": 0, - "slot": "103", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 339, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_balances", - "offset": 0, - "slot": "104", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 343, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_tokenApprovals", - "offset": 0, - "slot": "105", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 349, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_operatorApprovals", - "offset": 0, - "slot": "106", - "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" - }, - { - "astId": 1251, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "107", - "type": "t_array(t_uint256)44_storage" - }, - { - "astId": 10, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owner", - "offset": 0, - "slot": "151", - "type": "t_address" - }, - { - "astId": 130, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "152", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 11970, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "paymentOptions", - "offset": 0, - "slot": "201", - "type": "t_array(t_struct(PaymentOption)11951_storage)dyn_storage" - }, - { - "astId": 11972, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "baseURI", - "offset": 0, - "slot": "202", - "type": "t_string_storage" - }, - { - "astId": 11974, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "deprecatedAfter", - "offset": 0, - "slot": "203", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(PaymentOption)11951_storage)dyn_storage": { - "base": "t_struct(PaymentOption)11951_storage", - "encoding": "dynamic_array", - "label": "struct PaymentOption[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)44_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[44]", - "numberOfBytes": "1408" - }, - "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_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ISuperToken)9882": { - "encoding": "inplace", - "label": "contract ISuperToken", - "numberOfBytes": "20" - }, - "t_int96": { - "encoding": "inplace", - "label": "int96", - "numberOfBytes": "12" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,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_address)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PaymentOption)11951_storage": { - "encoding": "inplace", - "label": "struct PaymentOption", - "members": [ - { - "astId": 11946, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "incomingFlowToken", - "offset": 0, - "slot": "0", - "type": "t_contract(ISuperToken)9882" - }, - { - "astId": 11948, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "recipient", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 11950, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "requiredFlowRate", - "offset": 20, - "slot": "1", - "type": "t_int96" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - } - } - } -} \ No newline at end of file diff --git a/deployments/arbitrum-goerli/ExistentialNFTCloneFactory.json b/deployments/arbitrum-goerli/ExistentialNFTCloneFactory.json deleted file mode 100644 index 8f43ca2..0000000 --- a/deployments/arbitrum-goerli/ExistentialNFTCloneFactory.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "address": "0x22f391AB6755F0A8986AFD543289C43701beaCAa", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExistentialNFTCloneFactory_ArgumentLengthMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "clone", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_CloneDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_ImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "baseURI", - "type": "string" - } - ], - "name": "deployClone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "name": "updateImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x5d1d90a8359c94c6b0e4cedb015700192d27d0dbbad93de7b32ce990427fda8e", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0x22f391AB6755F0A8986AFD543289C43701beaCAa", - "transactionIndex": 1, - "gasUsed": "1053343", - "logsBloom": "0x00000000000000000100000000000000000000000000000000800000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000880000000000000000000000000000000400000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000020000000000000000000000000000000000000000000000000000000080000000000", - "blockHash": "0x1c8a16e6abc7c58b97a73d789b12b422eadc5c3181a25a657edb7cd9bf04401c", - "transactionHash": "0x5d1d90a8359c94c6b0e4cedb015700192d27d0dbbad93de7b32ce990427fda8e", - "logs": [ - { - "transactionIndex": 1, - "blockNumber": 40925713, - "transactionHash": "0x5d1d90a8359c94c6b0e4cedb015700192d27d0dbbad93de7b32ce990427fda8e", - "address": "0x22f391AB6755F0A8986AFD543289C43701beaCAa", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d15d5d0f5b1b56a4daef75cfe108cb825e97d015" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x1c8a16e6abc7c58b97a73d789b12b422eadc5c3181a25a657edb7cd9bf04401c" - } - ], - "blockNumber": 40925713, - "cumulativeGasUsed": "1053343", - "status": 1, - "byzantium": true - }, - "args": [ - "0xDa647B4e1432A6d27B99e06D96FE5dFd42BC7a63" - ], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExistentialNFTCloneFactory_ArgumentLengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"clone\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_CloneDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_ImplementationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"deployClone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"name\":\"updateImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFTCloneFactory.sol\":\"ExistentialNFTCloneFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.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 Ownable is Context {\\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 constructor() {\\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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"},\"contracts/ExistentialNFTCloneFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ExistentialNFT} from \\\"./ExistentialNFT.sol\\\";\\n\\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n\\ncontract ExistentialNFTCloneFactory is Ownable {\\n using Clones for address;\\n\\n address public implementation;\\n\\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\\n event ExistentialNFTCloneFactory_ImplementationUpdated(\\n address indexed implementation\\n );\\n\\n constructor(address _implementation) Ownable() {\\n implementation = _implementation;\\n }\\n\\n function deployClone(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory baseURI\\n ) external {\\n if (\\n !(incomingFlowTokens.length > 0 &&\\n incomingFlowTokens.length == recipients.length &&\\n incomingFlowTokens.length == requiredFlowRates.length)\\n ) {\\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n }\\n\\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\\n\\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\\n\\n clone.initialize(\\n owner,\\n incomingFlowTokens,\\n recipients,\\n requiredFlowRates,\\n name,\\n symbol,\\n baseURI\\n );\\n }\\n\\n function updateImplementation(address _implementation) external onlyOwner {\\n implementation = _implementation;\\n\\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\\n }\\n}\\n\",\"keccak256\":\"0xa483c580728b807503f233cac0822460d0db44b1c535372d03cf19ee5148dd0c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200133e3803806200133e8339818101604052810190620000379190620001d5565b620000576200004b6200009f60201b60201c565b620000a760201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000207565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019d8262000170565b9050919050565b620001af8162000190565b8114620001bb57600080fd5b50565b600081519050620001cf81620001a4565b92915050565b600060208284031215620001ee57620001ed6200016b565b5b6000620001fe84828501620001be565b91505092915050565b61112780620002176000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3049, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12591, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "implementation", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/arbitrum-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json b/deployments/arbitrum-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json deleted file mode 100644 index e19826a..0000000 --- a/deployments/arbitrum-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable {\n using SuperTokenV1Library for ISuperToken;\n\n PaymentOption[] private paymentOptions;\n string private _tokenURI;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory globalTokenURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n _tokenURI = globalTokenURI;\n }\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the global URI of the NFT set at deployment\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 0 ? \"\" : _tokenURI;\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory {\n using Clones for address;\n\n address public immutable implementation;\n\n event ExistentialNFT_CloneDeployed(address indexed clone);\n\n constructor(address _implementation) {\n implementation = _implementation;\n }\n\n function deployClone(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory tokenURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFT_CloneDeployed(address(clone));\n\n clone.initialize(\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n tokenURI\n );\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/arbitrum-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json b/deployments/arbitrum-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json deleted file mode 100644 index f27b856..0000000 --- a/deployments/arbitrum-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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/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/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _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 unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\nerror ExistentialNFT_Deprecated(uint256 at);\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\n using SuperTokenV1Library for ISuperToken;\n using Strings for address;\n using Strings for int96;\n\n PaymentOption[] private paymentOptions;\n string private baseURI;\n uint256 private deprecatedAfter;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory _baseURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n baseURI = _baseURI;\n }\n\n __Ownable_init();\n transferOwnership(owner);\n }\n\n /**\n * @notice add a new PaymentOption\n * @param incomingFlowToken - the address of the supertoken\n * @param recipient - the address of the recipient\n * @param requiredFlowRate - the required flow rate\n */\n function addPaymentOption(\n ISuperToken incomingFlowToken,\n address recipient,\n int96 requiredFlowRate\n ) public onlyOwner {\n paymentOptions.push(\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\n );\n }\n\n /**\n * @notice remove an existing PaymentOption\n * @param index - the index of the PaymentOption to be removed\n */\n function removePaymentOption(uint256 index) public onlyOwner {\n if (index >= paymentOptions.length) {\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\n }\n\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\n paymentOptions[i] = paymentOptions[i + 1];\n }\n\n paymentOptions.pop();\n }\n\n /**\n * @notice set a time, after which subscriptions are considered deprecated\n * 0 means the NFT is never deprecated\n * @dev only the recipient of the first PaymentOption can call this function\n * @param timestamp - the timestamp after which subscriptions are deprecated\n */\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\n deprecatedAfter = timestamp;\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the tokenURI for the owner\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return \"\";\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return \"\";\n }\n\n return balanceOf(owner) == 0 ? \"\" : constructTokenURI(owner);\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return address(0);\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return address(0);\n }\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n\n /**\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\n */\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\n }\n\n /**\n * @notice construct the tokenURI for an owner\n * @param owner - the address of the owner\n * @dev add dynamic queryparamaters at the end of the baseURI.\n * @return tokenURI - the tokenURI for the owner\n */\n function constructTokenURI(\n address owner\n ) private view returns (string memory) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return\n string.concat(\n baseURI,\n \"&symbol=\",\n symbol(),\n \"&token=\",\n address(paymentOption.incomingFlowToken).toHexString(),\n \"&sender=\",\n owner.toHexString(),\n \"&recipient=\",\n paymentOption.recipient.toHexString(),\n \"&flowrate=\",\n paymentOption.requiredFlowRate.toString(),\n \"&clone=\",\n address(this).toHexString()\n );\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory is Ownable {\n using Clones for address;\n\n address public implementation;\n\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\n event ExistentialNFTCloneFactory_ImplementationUpdated(\n address indexed implementation\n );\n\n constructor(address _implementation) Ownable() {\n implementation = _implementation;\n }\n\n function deployClone(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory baseURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\n\n clone.initialize(\n owner,\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n baseURI\n );\n }\n\n function updateImplementation(address _implementation) external onlyOwner {\n implementation = _implementation;\n\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/base-goerli/.chainId b/deployments/base-goerli/.chainId deleted file mode 100644 index 9b24bf0..0000000 --- a/deployments/base-goerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -84531 \ No newline at end of file diff --git a/deployments/base-goerli/ExistentialNFT.json b/deployments/base-goerli/ExistentialNFT.json deleted file mode 100644 index 8716519..0000000 --- a/deployments/base-goerli/ExistentialNFT.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "address": "0xE72830E7EbBFF8Ce0866059dE83caCD4263ACD08", - "abi": [ - { - "inputs": [], - "name": "ExistentialNFT_PaymentOptionIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "ExistentialNFT_TransferIsNotAllowed", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "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": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "name": "addPaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getPaymentOptionFor", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption", - "name": "result", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPaymentOptions", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_baseURI", - "type": "string" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "flowLastUpdated", - "type": "uint256" - } - ], - "name": "isDeprecated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "removePaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "setDeprecatedAfter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "tokenOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x37268845125831b476066ac217d6c766cb2ff3598c00e3ce1d91e63219f88cfd", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0xE72830E7EbBFF8Ce0866059dE83caCD4263ACD08", - "transactionIndex": 1, - "gasUsed": "3736192", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6246669f0184f672f7c6cedcf19391440cdd7ceedd97aef284c390855c148a67", - "transactionHash": "0x37268845125831b476066ac217d6c766cb2ff3598c00e3ce1d91e63219f88cfd", - "logs": [], - "blockNumber": 9657366, - "cumulativeGasUsed": "3783033", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ExistentialNFT_PaymentOptionIndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExistentialNFT_TransferIsNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"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\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"name\":\"addPaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"getPaymentOptionFor\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption\",\"name\":\"result\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPaymentOptions\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_baseURI\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"flowLastUpdated\",\"type\":\"uint256\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removePaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"setDeprecatedAfter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"tokenOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Superfluid Finance\",\"details\":\"Mirrors the Superfluid Checkout-Builder interface\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"}},\"kind\":\"dev\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"params\":{\"incomingFlowToken\":\"- the address of the supertoken\",\"recipient\":\"- the address of the recipient\",\"requiredFlowRate\":\"- the required flow rate\"}},\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\",\"returns\":{\"_0\":\"1 if the owner has a positive flow rate, 0 otherwise\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getPaymentOptionFor(address)\":{\"details\":\"@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\",\"params\":{\"owner\":\"- the address of the owner\",\"result\":\", the loop is not broken, so that the last match is returned.\"},\"returns\":{\"result\":\"PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\"}},\"getPaymentOptions()\":{\"returns\":{\"_0\":\"PaymentOption[] - all configured PaymentOptions\"}},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"details\":\"Array parameters should be the same size.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"@param owner - if they have a positive flow rate, otherwise zero address\"}},\"removePaymentOption(uint256)\":{\"params\":{\"index\":\"- the index of the PaymentOption to be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setDeprecatedAfter(uint256)\":{\"details\":\"only the recipient of the first PaymentOption can call this function\",\"params\":{\"timestamp\":\"- the timestamp after which subscriptions are deprecated\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenOf(address)\":{\"details\":\"one address can own only one token\",\"params\":{\"owner\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\"}},\"tokenURI(uint256)\":{\"details\":\"See {IERC721-tokenURI}.\",\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenURI - the tokenURI for the owner\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"notice\":\"add a new PaymentOption\"},\"balanceOf(address)\":{\"notice\":\"Overridden balanceOf, returning a value depending on the flow rate of the owner\"},\"getPaymentOptionFor(address)\":{\"notice\":\"match the owner to a PaymentOption\"},\"getPaymentOptions()\":{\"notice\":\"get all configured PaymentOptions\"},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"notice\":\"Initializes the contract setting the given PaymentOptions\"},\"isDeprecated(uint256)\":{\"notice\":\"Check if the flow is considered deprecated based on the lastUpdated value\"},\"ownerOf(uint256)\":{\"notice\":\"Overridden ownerOf, determines the owner, depending flow rate\"},\"removePaymentOption(uint256)\":{\"notice\":\"remove an existing PaymentOption\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"This NFT is not transferable\"},\"setDeprecatedAfter(uint256)\":{\"notice\":\"set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated\"},\"tokenOf(address)\":{\"notice\":\"get the tokenId for an owner\"},\"tokenURI(uint256)\":{\"notice\":\"Overridden tokenURI, returning the URI set at deployment\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"}},\"notice\":\"Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFT.sol\":\"ExistentialNFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506142e3806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "devdoc": { - "author": "Superfluid Finance", - "details": "Mirrors the Superfluid Checkout-Builder interface", - "events": { - "Approval(address,address,uint256)": { - "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." - }, - "ApprovalForAll(address,address,bool)": { - "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." - }, - "Initialized(uint8)": { - "details": "Triggered when the contract has been initialized or reinitialized." - }, - "Transfer(address,address,uint256)": { - "details": "Emitted when `tokenId` token is transferred from `from` to `to`." - } - }, - "kind": "dev", - "methods": { - "addPaymentOption(address,address,int96)": { - "params": { - "incomingFlowToken": "- the address of the supertoken", - "recipient": "- the address of the recipient", - "requiredFlowRate": "- the required flow rate" - } - }, - "approve(address,uint256)": { - "details": "See {IERC721-approve}." - }, - "balanceOf(address)": { - "details": "See {IERC721-balanceOf}.", - "returns": { - "_0": "1 if the owner has a positive flow rate, 0 otherwise" - } - }, - "getApproved(uint256)": { - "details": "See {IERC721-getApproved}." - }, - "getPaymentOptionFor(address)": { - "details": "@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned", - "params": { - "owner": "- the address of the owner", - "result": ", the loop is not broken, so that the last match is returned." - }, - "returns": { - "result": "PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption" - } - }, - "getPaymentOptions()": { - "returns": { - "_0": "PaymentOption[] - all configured PaymentOptions" - } - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "details": "Array parameters should be the same size." - }, - "isApprovedForAll(address,address)": { - "details": "See {IERC721-isApprovedForAll}." - }, - "name()": { - "details": "See {IERC721Metadata-name}." - }, - "owner()": { - "details": "Returns the address of the current owner." - }, - "ownerOf(uint256)": { - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "@param owner - if they have a positive flow rate, otherwise zero address" - } - }, - "removePaymentOption(uint256)": { - "params": { - "index": "- the index of the PaymentOption to be removed" - } - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "safeTransferFrom(address,address,uint256)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "setApprovalForAll(address,bool)": { - "details": "See {IERC721-setApprovalForAll}." - }, - "setDeprecatedAfter(uint256)": { - "details": "only the recipient of the first PaymentOption can call this function", - "params": { - "timestamp": "- the timestamp after which subscriptions are deprecated" - } - }, - "supportsInterface(bytes4)": { - "details": "See {IERC165-supportsInterface}." - }, - "symbol()": { - "details": "See {IERC721Metadata-symbol}." - }, - "tokenOf(address)": { - "details": "one address can own only one token", - "params": { - "owner": "- is the address of the owner" - }, - "returns": { - "_0": "tokenId - the address converted to uint256, 0 if the owner has no positive flow rate" - } - }, - "tokenURI(uint256)": { - "details": "See {IERC721-tokenURI}.", - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "tokenURI - the tokenURI for the owner" - } - }, - "transferFrom(address,address,uint256)": { - "details": "See {IERC721-transferFrom}." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "addPaymentOption(address,address,int96)": { - "notice": "add a new PaymentOption" - }, - "balanceOf(address)": { - "notice": "Overridden balanceOf, returning a value depending on the flow rate of the owner" - }, - "getPaymentOptionFor(address)": { - "notice": "match the owner to a PaymentOption" - }, - "getPaymentOptions()": { - "notice": "get all configured PaymentOptions" - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "notice": "Initializes the contract setting the given PaymentOptions" - }, - "isDeprecated(uint256)": { - "notice": "Check if the flow is considered deprecated based on the lastUpdated value" - }, - "ownerOf(uint256)": { - "notice": "Overridden ownerOf, determines the owner, depending flow rate" - }, - "removePaymentOption(uint256)": { - "notice": "remove an existing PaymentOption" - }, - "safeTransferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "This NFT is not transferable" - }, - "setDeprecatedAfter(uint256)": { - "notice": "set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated" - }, - "tokenOf(address)": { - "notice": "get the tokenId for an owner" - }, - "tokenURI(uint256)": { - "notice": "Overridden tokenURI, returning the URI set at deployment" - }, - "transferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - } - }, - "notice": "Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 138, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 1784, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 2057, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "51", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 329, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_name", - "offset": 0, - "slot": "101", - "type": "t_string_storage" - }, - { - "astId": 331, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_symbol", - "offset": 0, - "slot": "102", - "type": "t_string_storage" - }, - { - "astId": 335, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owners", - "offset": 0, - "slot": "103", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 339, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_balances", - "offset": 0, - "slot": "104", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 343, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_tokenApprovals", - "offset": 0, - "slot": "105", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 349, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_operatorApprovals", - "offset": 0, - "slot": "106", - "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" - }, - { - "astId": 1251, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "107", - "type": "t_array(t_uint256)44_storage" - }, - { - "astId": 10, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owner", - "offset": 0, - "slot": "151", - "type": "t_address" - }, - { - "astId": 130, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "152", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 11970, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "paymentOptions", - "offset": 0, - "slot": "201", - "type": "t_array(t_struct(PaymentOption)11951_storage)dyn_storage" - }, - { - "astId": 11972, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "baseURI", - "offset": 0, - "slot": "202", - "type": "t_string_storage" - }, - { - "astId": 11974, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "deprecatedAfter", - "offset": 0, - "slot": "203", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(PaymentOption)11951_storage)dyn_storage": { - "base": "t_struct(PaymentOption)11951_storage", - "encoding": "dynamic_array", - "label": "struct PaymentOption[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)44_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[44]", - "numberOfBytes": "1408" - }, - "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_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ISuperToken)9882": { - "encoding": "inplace", - "label": "contract ISuperToken", - "numberOfBytes": "20" - }, - "t_int96": { - "encoding": "inplace", - "label": "int96", - "numberOfBytes": "12" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,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_address)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PaymentOption)11951_storage": { - "encoding": "inplace", - "label": "struct PaymentOption", - "members": [ - { - "astId": 11946, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "incomingFlowToken", - "offset": 0, - "slot": "0", - "type": "t_contract(ISuperToken)9882" - }, - { - "astId": 11948, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "recipient", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 11950, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "requiredFlowRate", - "offset": 20, - "slot": "1", - "type": "t_int96" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - } - } - } -} \ No newline at end of file diff --git a/deployments/base-goerli/ExistentialNFTCloneFactory.json b/deployments/base-goerli/ExistentialNFTCloneFactory.json deleted file mode 100644 index 49cfd89..0000000 --- a/deployments/base-goerli/ExistentialNFTCloneFactory.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "address": "0x42B332F56BCD15F0D7cd523E5eC26Cd0734621eD", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExistentialNFTCloneFactory_ArgumentLengthMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "clone", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_CloneDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_ImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "baseURI", - "type": "string" - } - ], - "name": "deployClone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "name": "updateImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x4d556e5660d73462fa94c928046b17ba6c71e61f7b8e43b8baff2b5dc12006c7", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0x42B332F56BCD15F0D7cd523E5eC26Cd0734621eD", - "transactionIndex": 2, - "gasUsed": "1053343", - "logsBloom": "0x00000000000000000100000000000000000000000000000000800000000000000000000000000000000020000200000000000000000000000000000000000000000000000000000040000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000200000000000000000000000000000000080000000000", - "blockHash": "0x0e1f253281f5e27fafecd9779fec9e05b68e8575ea0f9e4db29a26937f65e7f0", - "transactionHash": "0x4d556e5660d73462fa94c928046b17ba6c71e61f7b8e43b8baff2b5dc12006c7", - "logs": [ - { - "transactionIndex": 2, - "blockNumber": 9657379, - "transactionHash": "0x4d556e5660d73462fa94c928046b17ba6c71e61f7b8e43b8baff2b5dc12006c7", - "address": "0x42B332F56BCD15F0D7cd523E5eC26Cd0734621eD", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d15d5d0f5b1b56a4daef75cfe108cb825e97d015" - ], - "data": "0x", - "logIndex": 1, - "blockHash": "0x0e1f253281f5e27fafecd9779fec9e05b68e8575ea0f9e4db29a26937f65e7f0" - } - ], - "blockNumber": 9657379, - "cumulativeGasUsed": "1180490", - "status": 1, - "byzantium": true - }, - "args": [ - "0xE72830E7EbBFF8Ce0866059dE83caCD4263ACD08" - ], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExistentialNFTCloneFactory_ArgumentLengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"clone\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_CloneDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_ImplementationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"deployClone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"name\":\"updateImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFTCloneFactory.sol\":\"ExistentialNFTCloneFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.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 Ownable is Context {\\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 constructor() {\\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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"},\"contracts/ExistentialNFTCloneFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ExistentialNFT} from \\\"./ExistentialNFT.sol\\\";\\n\\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n\\ncontract ExistentialNFTCloneFactory is Ownable {\\n using Clones for address;\\n\\n address public implementation;\\n\\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\\n event ExistentialNFTCloneFactory_ImplementationUpdated(\\n address indexed implementation\\n );\\n\\n constructor(address _implementation) Ownable() {\\n implementation = _implementation;\\n }\\n\\n function deployClone(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory baseURI\\n ) external {\\n if (\\n !(incomingFlowTokens.length > 0 &&\\n incomingFlowTokens.length == recipients.length &&\\n incomingFlowTokens.length == requiredFlowRates.length)\\n ) {\\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n }\\n\\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\\n\\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\\n\\n clone.initialize(\\n owner,\\n incomingFlowTokens,\\n recipients,\\n requiredFlowRates,\\n name,\\n symbol,\\n baseURI\\n );\\n }\\n\\n function updateImplementation(address _implementation) external onlyOwner {\\n implementation = _implementation;\\n\\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\\n }\\n}\\n\",\"keccak256\":\"0xa483c580728b807503f233cac0822460d0db44b1c535372d03cf19ee5148dd0c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200133e3803806200133e8339818101604052810190620000379190620001d5565b620000576200004b6200009f60201b60201c565b620000a760201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000207565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019d8262000170565b9050919050565b620001af8162000190565b8114620001bb57600080fd5b50565b600081519050620001cf81620001a4565b92915050565b600060208284031215620001ee57620001ed6200016b565b5b6000620001fe84828501620001be565b91505092915050565b61112780620002176000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3049, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12591, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "implementation", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/base-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json b/deployments/base-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json deleted file mode 100644 index e19826a..0000000 --- a/deployments/base-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable {\n using SuperTokenV1Library for ISuperToken;\n\n PaymentOption[] private paymentOptions;\n string private _tokenURI;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory globalTokenURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n _tokenURI = globalTokenURI;\n }\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the global URI of the NFT set at deployment\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 0 ? \"\" : _tokenURI;\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory {\n using Clones for address;\n\n address public immutable implementation;\n\n event ExistentialNFT_CloneDeployed(address indexed clone);\n\n constructor(address _implementation) {\n implementation = _implementation;\n }\n\n function deployClone(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory tokenURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFT_CloneDeployed(address(clone));\n\n clone.initialize(\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n tokenURI\n );\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/base-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json b/deployments/base-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json deleted file mode 100644 index f27b856..0000000 --- a/deployments/base-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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/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/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _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 unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\nerror ExistentialNFT_Deprecated(uint256 at);\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\n using SuperTokenV1Library for ISuperToken;\n using Strings for address;\n using Strings for int96;\n\n PaymentOption[] private paymentOptions;\n string private baseURI;\n uint256 private deprecatedAfter;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory _baseURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n baseURI = _baseURI;\n }\n\n __Ownable_init();\n transferOwnership(owner);\n }\n\n /**\n * @notice add a new PaymentOption\n * @param incomingFlowToken - the address of the supertoken\n * @param recipient - the address of the recipient\n * @param requiredFlowRate - the required flow rate\n */\n function addPaymentOption(\n ISuperToken incomingFlowToken,\n address recipient,\n int96 requiredFlowRate\n ) public onlyOwner {\n paymentOptions.push(\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\n );\n }\n\n /**\n * @notice remove an existing PaymentOption\n * @param index - the index of the PaymentOption to be removed\n */\n function removePaymentOption(uint256 index) public onlyOwner {\n if (index >= paymentOptions.length) {\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\n }\n\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\n paymentOptions[i] = paymentOptions[i + 1];\n }\n\n paymentOptions.pop();\n }\n\n /**\n * @notice set a time, after which subscriptions are considered deprecated\n * 0 means the NFT is never deprecated\n * @dev only the recipient of the first PaymentOption can call this function\n * @param timestamp - the timestamp after which subscriptions are deprecated\n */\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\n deprecatedAfter = timestamp;\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the tokenURI for the owner\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return \"\";\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return \"\";\n }\n\n return balanceOf(owner) == 0 ? \"\" : constructTokenURI(owner);\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return address(0);\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return address(0);\n }\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n\n /**\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\n */\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\n }\n\n /**\n * @notice construct the tokenURI for an owner\n * @param owner - the address of the owner\n * @dev add dynamic queryparamaters at the end of the baseURI.\n * @return tokenURI - the tokenURI for the owner\n */\n function constructTokenURI(\n address owner\n ) private view returns (string memory) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return\n string.concat(\n baseURI,\n \"&symbol=\",\n symbol(),\n \"&token=\",\n address(paymentOption.incomingFlowToken).toHexString(),\n \"&sender=\",\n owner.toHexString(),\n \"&recipient=\",\n paymentOption.recipient.toHexString(),\n \"&flowrate=\",\n paymentOption.requiredFlowRate.toString(),\n \"&clone=\",\n address(this).toHexString()\n );\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory is Ownable {\n using Clones for address;\n\n address public implementation;\n\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\n event ExistentialNFTCloneFactory_ImplementationUpdated(\n address indexed implementation\n );\n\n constructor(address _implementation) Ownable() {\n implementation = _implementation;\n }\n\n function deployClone(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory baseURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\n\n clone.initialize(\n owner,\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n baseURI\n );\n }\n\n function updateImplementation(address _implementation) external onlyOwner {\n implementation = _implementation;\n\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/eth-goerli/.chainId b/deployments/eth-goerli/.chainId deleted file mode 100644 index 7813681..0000000 --- a/deployments/eth-goerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/deployments/eth-goerli/ExistentialNFT.json b/deployments/eth-goerli/ExistentialNFT.json deleted file mode 100644 index a938633..0000000 --- a/deployments/eth-goerli/ExistentialNFT.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "address": "0xaeB25aD942A269df0233F7f944Cc482FC4aE43dE", - "abi": [ - { - "inputs": [], - "name": "ExistentialNFT_PaymentOptionIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "ExistentialNFT_TransferIsNotAllowed", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "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": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "name": "addPaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getPaymentOptionFor", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption", - "name": "result", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPaymentOptions", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_baseURI", - "type": "string" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "flowLastUpdated", - "type": "uint256" - } - ], - "name": "isDeprecated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "removePaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "setDeprecatedAfter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "tokenOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x6822bd7768861a086208e16b6dec6c3555746651f9e93d1a5b3aed3944af041c", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0xaeB25aD942A269df0233F7f944Cc482FC4aE43dE", - "transactionIndex": 8, - "gasUsed": "3737266", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfc3623b63138fae4d5f1bb94d4542048e23a4edb12d3a6ef90ec1abacbf28978", - "transactionHash": "0x6822bd7768861a086208e16b6dec6c3555746651f9e93d1a5b3aed3944af041c", - "logs": [], - "blockNumber": 9680969, - "cumulativeGasUsed": "4085755", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ExistentialNFT_PaymentOptionIndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExistentialNFT_TransferIsNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"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\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"name\":\"addPaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"getPaymentOptionFor\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption\",\"name\":\"result\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPaymentOptions\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_baseURI\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"flowLastUpdated\",\"type\":\"uint256\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removePaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"setDeprecatedAfter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"tokenOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Superfluid Finance\",\"details\":\"Mirrors the Superfluid Checkout-Builder interface\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"}},\"kind\":\"dev\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"params\":{\"incomingFlowToken\":\"- the address of the supertoken\",\"recipient\":\"- the address of the recipient\",\"requiredFlowRate\":\"- the required flow rate\"}},\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\",\"returns\":{\"_0\":\"1 if the owner has a positive flow rate, 0 otherwise\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getPaymentOptionFor(address)\":{\"details\":\"@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\",\"params\":{\"owner\":\"- the address of the owner\",\"result\":\", the loop is not broken, so that the last match is returned.\"},\"returns\":{\"result\":\"PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\"}},\"getPaymentOptions()\":{\"returns\":{\"_0\":\"PaymentOption[] - all configured PaymentOptions\"}},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"details\":\"Array parameters should be the same size.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"@param owner - if they have a positive flow rate, otherwise zero address\"}},\"removePaymentOption(uint256)\":{\"params\":{\"index\":\"- the index of the PaymentOption to be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setDeprecatedAfter(uint256)\":{\"details\":\"only the recipient of the first PaymentOption can call this function\",\"params\":{\"timestamp\":\"- the timestamp after which subscriptions are deprecated\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenOf(address)\":{\"details\":\"one address can own only one token\",\"params\":{\"owner\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\"}},\"tokenURI(uint256)\":{\"details\":\"See {IERC721-tokenURI}.\",\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenURI - the tokenURI for the owner\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"notice\":\"add a new PaymentOption\"},\"balanceOf(address)\":{\"notice\":\"Overridden balanceOf, returning a value depending on the flow rate of the owner\"},\"getPaymentOptionFor(address)\":{\"notice\":\"match the owner to a PaymentOption\"},\"getPaymentOptions()\":{\"notice\":\"get all configured PaymentOptions\"},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"notice\":\"Initializes the contract setting the given PaymentOptions\"},\"isDeprecated(uint256)\":{\"notice\":\"Check if the flow is considered deprecated based on the lastUpdated value\"},\"ownerOf(uint256)\":{\"notice\":\"Overridden ownerOf, determines the owner, depending flow rate\"},\"removePaymentOption(uint256)\":{\"notice\":\"remove an existing PaymentOption\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"This NFT is not transferable\"},\"setDeprecatedAfter(uint256)\":{\"notice\":\"set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated\"},\"tokenOf(address)\":{\"notice\":\"get the tokenId for an owner\"},\"tokenURI(uint256)\":{\"notice\":\"Overridden tokenURI, returning the URI set at deployment\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"}},\"notice\":\"Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFT.sol\":\"ExistentialNFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506142e3806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "devdoc": { - "author": "Superfluid Finance", - "details": "Mirrors the Superfluid Checkout-Builder interface", - "events": { - "Approval(address,address,uint256)": { - "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." - }, - "ApprovalForAll(address,address,bool)": { - "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." - }, - "Initialized(uint8)": { - "details": "Triggered when the contract has been initialized or reinitialized." - }, - "Transfer(address,address,uint256)": { - "details": "Emitted when `tokenId` token is transferred from `from` to `to`." - } - }, - "kind": "dev", - "methods": { - "addPaymentOption(address,address,int96)": { - "params": { - "incomingFlowToken": "- the address of the supertoken", - "recipient": "- the address of the recipient", - "requiredFlowRate": "- the required flow rate" - } - }, - "approve(address,uint256)": { - "details": "See {IERC721-approve}." - }, - "balanceOf(address)": { - "details": "See {IERC721-balanceOf}.", - "returns": { - "_0": "1 if the owner has a positive flow rate, 0 otherwise" - } - }, - "getApproved(uint256)": { - "details": "See {IERC721-getApproved}." - }, - "getPaymentOptionFor(address)": { - "details": "@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned", - "params": { - "owner": "- the address of the owner", - "result": ", the loop is not broken, so that the last match is returned." - }, - "returns": { - "result": "PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption" - } - }, - "getPaymentOptions()": { - "returns": { - "_0": "PaymentOption[] - all configured PaymentOptions" - } - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "details": "Array parameters should be the same size." - }, - "isApprovedForAll(address,address)": { - "details": "See {IERC721-isApprovedForAll}." - }, - "name()": { - "details": "See {IERC721Metadata-name}." - }, - "owner()": { - "details": "Returns the address of the current owner." - }, - "ownerOf(uint256)": { - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "@param owner - if they have a positive flow rate, otherwise zero address" - } - }, - "removePaymentOption(uint256)": { - "params": { - "index": "- the index of the PaymentOption to be removed" - } - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "safeTransferFrom(address,address,uint256)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "setApprovalForAll(address,bool)": { - "details": "See {IERC721-setApprovalForAll}." - }, - "setDeprecatedAfter(uint256)": { - "details": "only the recipient of the first PaymentOption can call this function", - "params": { - "timestamp": "- the timestamp after which subscriptions are deprecated" - } - }, - "supportsInterface(bytes4)": { - "details": "See {IERC165-supportsInterface}." - }, - "symbol()": { - "details": "See {IERC721Metadata-symbol}." - }, - "tokenOf(address)": { - "details": "one address can own only one token", - "params": { - "owner": "- is the address of the owner" - }, - "returns": { - "_0": "tokenId - the address converted to uint256, 0 if the owner has no positive flow rate" - } - }, - "tokenURI(uint256)": { - "details": "See {IERC721-tokenURI}.", - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "tokenURI - the tokenURI for the owner" - } - }, - "transferFrom(address,address,uint256)": { - "details": "See {IERC721-transferFrom}." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "addPaymentOption(address,address,int96)": { - "notice": "add a new PaymentOption" - }, - "balanceOf(address)": { - "notice": "Overridden balanceOf, returning a value depending on the flow rate of the owner" - }, - "getPaymentOptionFor(address)": { - "notice": "match the owner to a PaymentOption" - }, - "getPaymentOptions()": { - "notice": "get all configured PaymentOptions" - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "notice": "Initializes the contract setting the given PaymentOptions" - }, - "isDeprecated(uint256)": { - "notice": "Check if the flow is considered deprecated based on the lastUpdated value" - }, - "ownerOf(uint256)": { - "notice": "Overridden ownerOf, determines the owner, depending flow rate" - }, - "removePaymentOption(uint256)": { - "notice": "remove an existing PaymentOption" - }, - "safeTransferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "This NFT is not transferable" - }, - "setDeprecatedAfter(uint256)": { - "notice": "set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated" - }, - "tokenOf(address)": { - "notice": "get the tokenId for an owner" - }, - "tokenURI(uint256)": { - "notice": "Overridden tokenURI, returning the URI set at deployment" - }, - "transferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - } - }, - "notice": "Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 138, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 1784, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 2057, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "51", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 329, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_name", - "offset": 0, - "slot": "101", - "type": "t_string_storage" - }, - { - "astId": 331, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_symbol", - "offset": 0, - "slot": "102", - "type": "t_string_storage" - }, - { - "astId": 335, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owners", - "offset": 0, - "slot": "103", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 339, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_balances", - "offset": 0, - "slot": "104", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 343, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_tokenApprovals", - "offset": 0, - "slot": "105", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 349, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_operatorApprovals", - "offset": 0, - "slot": "106", - "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" - }, - { - "astId": 1251, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "107", - "type": "t_array(t_uint256)44_storage" - }, - { - "astId": 10, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owner", - "offset": 0, - "slot": "151", - "type": "t_address" - }, - { - "astId": 130, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "152", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 11970, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "paymentOptions", - "offset": 0, - "slot": "201", - "type": "t_array(t_struct(PaymentOption)11951_storage)dyn_storage" - }, - { - "astId": 11972, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "baseURI", - "offset": 0, - "slot": "202", - "type": "t_string_storage" - }, - { - "astId": 11974, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "deprecatedAfter", - "offset": 0, - "slot": "203", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(PaymentOption)11951_storage)dyn_storage": { - "base": "t_struct(PaymentOption)11951_storage", - "encoding": "dynamic_array", - "label": "struct PaymentOption[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)44_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[44]", - "numberOfBytes": "1408" - }, - "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_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ISuperToken)9882": { - "encoding": "inplace", - "label": "contract ISuperToken", - "numberOfBytes": "20" - }, - "t_int96": { - "encoding": "inplace", - "label": "int96", - "numberOfBytes": "12" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,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_address)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PaymentOption)11951_storage": { - "encoding": "inplace", - "label": "struct PaymentOption", - "members": [ - { - "astId": 11946, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "incomingFlowToken", - "offset": 0, - "slot": "0", - "type": "t_contract(ISuperToken)9882" - }, - { - "astId": 11948, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "recipient", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 11950, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "requiredFlowRate", - "offset": 20, - "slot": "1", - "type": "t_int96" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - } - } - } -} \ No newline at end of file diff --git a/deployments/eth-goerli/ExistentialNFTCloneFactory.json b/deployments/eth-goerli/ExistentialNFTCloneFactory.json deleted file mode 100644 index 155bf15..0000000 --- a/deployments/eth-goerli/ExistentialNFTCloneFactory.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "address": "0x3e5e8449477F80a3Dc0bA394882AeAB300c7F807", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExistentialNFTCloneFactory_ArgumentLengthMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "clone", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_CloneDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_ImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "baseURI", - "type": "string" - } - ], - "name": "deployClone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "name": "updateImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xfb1d343cc68c18896495f8836dc7375234284092a3a57796aff992c2dbcfae1f", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0x3e5e8449477F80a3Dc0bA394882AeAB300c7F807", - "transactionIndex": 4, - "gasUsed": "1053653", - "logsBloom": "0x00000000000000000100000000000000000000000000000000800000000000000000000000002000000020000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000800000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000080000000000", - "blockHash": "0xc98fcc64c746c458790d8b40e4aa670bb8f2db14b7b4a6d5d6a8528372b4efff", - "transactionHash": "0xfb1d343cc68c18896495f8836dc7375234284092a3a57796aff992c2dbcfae1f", - "logs": [ - { - "transactionIndex": 4, - "blockNumber": 9680974, - "transactionHash": "0xfb1d343cc68c18896495f8836dc7375234284092a3a57796aff992c2dbcfae1f", - "address": "0x3e5e8449477F80a3Dc0bA394882AeAB300c7F807", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d15d5d0f5b1b56a4daef75cfe108cb825e97d015" - ], - "data": "0x", - "logIndex": 4, - "blockHash": "0xc98fcc64c746c458790d8b40e4aa670bb8f2db14b7b4a6d5d6a8528372b4efff" - } - ], - "blockNumber": 9680974, - "cumulativeGasUsed": "1229776", - "status": 1, - "byzantium": true - }, - "args": [ - "0xaeB25aD942A269df0233F7f944Cc482FC4aE43dE" - ], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExistentialNFTCloneFactory_ArgumentLengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"clone\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_CloneDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_ImplementationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"deployClone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"name\":\"updateImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFTCloneFactory.sol\":\"ExistentialNFTCloneFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.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 Ownable is Context {\\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 constructor() {\\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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"},\"contracts/ExistentialNFTCloneFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ExistentialNFT} from \\\"./ExistentialNFT.sol\\\";\\n\\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n\\ncontract ExistentialNFTCloneFactory is Ownable {\\n using Clones for address;\\n\\n address public implementation;\\n\\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\\n event ExistentialNFTCloneFactory_ImplementationUpdated(\\n address indexed implementation\\n );\\n\\n constructor(address _implementation) Ownable() {\\n implementation = _implementation;\\n }\\n\\n function deployClone(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory baseURI\\n ) external {\\n if (\\n !(incomingFlowTokens.length > 0 &&\\n incomingFlowTokens.length == recipients.length &&\\n incomingFlowTokens.length == requiredFlowRates.length)\\n ) {\\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n }\\n\\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\\n\\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\\n\\n clone.initialize(\\n owner,\\n incomingFlowTokens,\\n recipients,\\n requiredFlowRates,\\n name,\\n symbol,\\n baseURI\\n );\\n }\\n\\n function updateImplementation(address _implementation) external onlyOwner {\\n implementation = _implementation;\\n\\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\\n }\\n}\\n\",\"keccak256\":\"0xa483c580728b807503f233cac0822460d0db44b1c535372d03cf19ee5148dd0c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200133e3803806200133e8339818101604052810190620000379190620001d5565b620000576200004b6200009f60201b60201c565b620000a760201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000207565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019d8262000170565b9050919050565b620001af8162000190565b8114620001bb57600080fd5b50565b600081519050620001cf81620001a4565b92915050565b600060208284031215620001ee57620001ed6200016b565b5b6000620001fe84828501620001be565b91505092915050565b61112780620002176000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3049, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12591, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "implementation", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/eth-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json b/deployments/eth-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json deleted file mode 100644 index e19826a..0000000 --- a/deployments/eth-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable {\n using SuperTokenV1Library for ISuperToken;\n\n PaymentOption[] private paymentOptions;\n string private _tokenURI;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory globalTokenURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n _tokenURI = globalTokenURI;\n }\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the global URI of the NFT set at deployment\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 0 ? \"\" : _tokenURI;\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory {\n using Clones for address;\n\n address public immutable implementation;\n\n event ExistentialNFT_CloneDeployed(address indexed clone);\n\n constructor(address _implementation) {\n implementation = _implementation;\n }\n\n function deployClone(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory tokenURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFT_CloneDeployed(address(clone));\n\n clone.initialize(\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n tokenURI\n );\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/eth-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json b/deployments/eth-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json deleted file mode 100644 index f27b856..0000000 --- a/deployments/eth-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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/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/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _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 unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\nerror ExistentialNFT_Deprecated(uint256 at);\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\n using SuperTokenV1Library for ISuperToken;\n using Strings for address;\n using Strings for int96;\n\n PaymentOption[] private paymentOptions;\n string private baseURI;\n uint256 private deprecatedAfter;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory _baseURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n baseURI = _baseURI;\n }\n\n __Ownable_init();\n transferOwnership(owner);\n }\n\n /**\n * @notice add a new PaymentOption\n * @param incomingFlowToken - the address of the supertoken\n * @param recipient - the address of the recipient\n * @param requiredFlowRate - the required flow rate\n */\n function addPaymentOption(\n ISuperToken incomingFlowToken,\n address recipient,\n int96 requiredFlowRate\n ) public onlyOwner {\n paymentOptions.push(\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\n );\n }\n\n /**\n * @notice remove an existing PaymentOption\n * @param index - the index of the PaymentOption to be removed\n */\n function removePaymentOption(uint256 index) public onlyOwner {\n if (index >= paymentOptions.length) {\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\n }\n\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\n paymentOptions[i] = paymentOptions[i + 1];\n }\n\n paymentOptions.pop();\n }\n\n /**\n * @notice set a time, after which subscriptions are considered deprecated\n * 0 means the NFT is never deprecated\n * @dev only the recipient of the first PaymentOption can call this function\n * @param timestamp - the timestamp after which subscriptions are deprecated\n */\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\n deprecatedAfter = timestamp;\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the tokenURI for the owner\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return \"\";\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return \"\";\n }\n\n return balanceOf(owner) == 0 ? \"\" : constructTokenURI(owner);\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return address(0);\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return address(0);\n }\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n\n /**\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\n */\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\n }\n\n /**\n * @notice construct the tokenURI for an owner\n * @param owner - the address of the owner\n * @dev add dynamic queryparamaters at the end of the baseURI.\n * @return tokenURI - the tokenURI for the owner\n */\n function constructTokenURI(\n address owner\n ) private view returns (string memory) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return\n string.concat(\n baseURI,\n \"&symbol=\",\n symbol(),\n \"&token=\",\n address(paymentOption.incomingFlowToken).toHexString(),\n \"&sender=\",\n owner.toHexString(),\n \"&recipient=\",\n paymentOption.recipient.toHexString(),\n \"&flowrate=\",\n paymentOption.requiredFlowRate.toString(),\n \"&clone=\",\n address(this).toHexString()\n );\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory is Ownable {\n using Clones for address;\n\n address public implementation;\n\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\n event ExistentialNFTCloneFactory_ImplementationUpdated(\n address indexed implementation\n );\n\n constructor(address _implementation) Ownable() {\n implementation = _implementation;\n }\n\n function deployClone(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory baseURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\n\n clone.initialize(\n owner,\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n baseURI\n );\n }\n\n function updateImplementation(address _implementation) external onlyOwner {\n implementation = _implementation;\n\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/optimism-goerli/.chainId b/deployments/optimism-goerli/.chainId deleted file mode 100644 index 1e59c84..0000000 --- a/deployments/optimism-goerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -420 \ No newline at end of file diff --git a/deployments/optimism-goerli/ExistentialNFT.json b/deployments/optimism-goerli/ExistentialNFT.json deleted file mode 100644 index 9e625c8..0000000 --- a/deployments/optimism-goerli/ExistentialNFT.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "address": "0x8054BDE640E828492b22606e076CeFb2D6a228ea", - "abi": [ - { - "inputs": [], - "name": "ExistentialNFT_PaymentOptionIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "ExistentialNFT_TransferIsNotAllowed", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "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": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "name": "addPaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getPaymentOptionFor", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption", - "name": "result", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPaymentOptions", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_baseURI", - "type": "string" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "flowLastUpdated", - "type": "uint256" - } - ], - "name": "isDeprecated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "removePaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "setDeprecatedAfter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "tokenOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x2a0da2a1b3c1789e69c378d1be37d5ea1c88f5371a7ee31ffa5d83a994e03473", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0x8054BDE640E828492b22606e076CeFb2D6a228ea", - "transactionIndex": 1, - "gasUsed": "3736192", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xca3f002c87661c9ea68a00ffdd8de4c111b23ab12ad7d6fa3a9d73e4a290d0ed", - "transactionHash": "0x2a0da2a1b3c1789e69c378d1be37d5ea1c88f5371a7ee31ffa5d83a994e03473", - "logs": [], - "blockNumber": 14540351, - "cumulativeGasUsed": "3783045", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ExistentialNFT_PaymentOptionIndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExistentialNFT_TransferIsNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"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\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"name\":\"addPaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"getPaymentOptionFor\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption\",\"name\":\"result\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPaymentOptions\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_baseURI\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"flowLastUpdated\",\"type\":\"uint256\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removePaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"setDeprecatedAfter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"tokenOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Superfluid Finance\",\"details\":\"Mirrors the Superfluid Checkout-Builder interface\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"}},\"kind\":\"dev\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"params\":{\"incomingFlowToken\":\"- the address of the supertoken\",\"recipient\":\"- the address of the recipient\",\"requiredFlowRate\":\"- the required flow rate\"}},\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\",\"returns\":{\"_0\":\"1 if the owner has a positive flow rate, 0 otherwise\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getPaymentOptionFor(address)\":{\"details\":\"@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\",\"params\":{\"owner\":\"- the address of the owner\",\"result\":\", the loop is not broken, so that the last match is returned.\"},\"returns\":{\"result\":\"PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\"}},\"getPaymentOptions()\":{\"returns\":{\"_0\":\"PaymentOption[] - all configured PaymentOptions\"}},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"details\":\"Array parameters should be the same size.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"@param owner - if they have a positive flow rate, otherwise zero address\"}},\"removePaymentOption(uint256)\":{\"params\":{\"index\":\"- the index of the PaymentOption to be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setDeprecatedAfter(uint256)\":{\"details\":\"only the recipient of the first PaymentOption can call this function\",\"params\":{\"timestamp\":\"- the timestamp after which subscriptions are deprecated\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenOf(address)\":{\"details\":\"one address can own only one token\",\"params\":{\"owner\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\"}},\"tokenURI(uint256)\":{\"details\":\"See {IERC721-tokenURI}.\",\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenURI - the tokenURI for the owner\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"notice\":\"add a new PaymentOption\"},\"balanceOf(address)\":{\"notice\":\"Overridden balanceOf, returning a value depending on the flow rate of the owner\"},\"getPaymentOptionFor(address)\":{\"notice\":\"match the owner to a PaymentOption\"},\"getPaymentOptions()\":{\"notice\":\"get all configured PaymentOptions\"},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"notice\":\"Initializes the contract setting the given PaymentOptions\"},\"isDeprecated(uint256)\":{\"notice\":\"Check if the flow is considered deprecated based on the lastUpdated value\"},\"ownerOf(uint256)\":{\"notice\":\"Overridden ownerOf, determines the owner, depending flow rate\"},\"removePaymentOption(uint256)\":{\"notice\":\"remove an existing PaymentOption\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"This NFT is not transferable\"},\"setDeprecatedAfter(uint256)\":{\"notice\":\"set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated\"},\"tokenOf(address)\":{\"notice\":\"get the tokenId for an owner\"},\"tokenURI(uint256)\":{\"notice\":\"Overridden tokenURI, returning the URI set at deployment\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"}},\"notice\":\"Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFT.sol\":\"ExistentialNFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506142e3806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "devdoc": { - "author": "Superfluid Finance", - "details": "Mirrors the Superfluid Checkout-Builder interface", - "events": { - "Approval(address,address,uint256)": { - "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." - }, - "ApprovalForAll(address,address,bool)": { - "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." - }, - "Initialized(uint8)": { - "details": "Triggered when the contract has been initialized or reinitialized." - }, - "Transfer(address,address,uint256)": { - "details": "Emitted when `tokenId` token is transferred from `from` to `to`." - } - }, - "kind": "dev", - "methods": { - "addPaymentOption(address,address,int96)": { - "params": { - "incomingFlowToken": "- the address of the supertoken", - "recipient": "- the address of the recipient", - "requiredFlowRate": "- the required flow rate" - } - }, - "approve(address,uint256)": { - "details": "See {IERC721-approve}." - }, - "balanceOf(address)": { - "details": "See {IERC721-balanceOf}.", - "returns": { - "_0": "1 if the owner has a positive flow rate, 0 otherwise" - } - }, - "getApproved(uint256)": { - "details": "See {IERC721-getApproved}." - }, - "getPaymentOptionFor(address)": { - "details": "@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned", - "params": { - "owner": "- the address of the owner", - "result": ", the loop is not broken, so that the last match is returned." - }, - "returns": { - "result": "PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption" - } - }, - "getPaymentOptions()": { - "returns": { - "_0": "PaymentOption[] - all configured PaymentOptions" - } - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "details": "Array parameters should be the same size." - }, - "isApprovedForAll(address,address)": { - "details": "See {IERC721-isApprovedForAll}." - }, - "name()": { - "details": "See {IERC721Metadata-name}." - }, - "owner()": { - "details": "Returns the address of the current owner." - }, - "ownerOf(uint256)": { - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "@param owner - if they have a positive flow rate, otherwise zero address" - } - }, - "removePaymentOption(uint256)": { - "params": { - "index": "- the index of the PaymentOption to be removed" - } - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "safeTransferFrom(address,address,uint256)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "setApprovalForAll(address,bool)": { - "details": "See {IERC721-setApprovalForAll}." - }, - "setDeprecatedAfter(uint256)": { - "details": "only the recipient of the first PaymentOption can call this function", - "params": { - "timestamp": "- the timestamp after which subscriptions are deprecated" - } - }, - "supportsInterface(bytes4)": { - "details": "See {IERC165-supportsInterface}." - }, - "symbol()": { - "details": "See {IERC721Metadata-symbol}." - }, - "tokenOf(address)": { - "details": "one address can own only one token", - "params": { - "owner": "- is the address of the owner" - }, - "returns": { - "_0": "tokenId - the address converted to uint256, 0 if the owner has no positive flow rate" - } - }, - "tokenURI(uint256)": { - "details": "See {IERC721-tokenURI}.", - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "tokenURI - the tokenURI for the owner" - } - }, - "transferFrom(address,address,uint256)": { - "details": "See {IERC721-transferFrom}." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "addPaymentOption(address,address,int96)": { - "notice": "add a new PaymentOption" - }, - "balanceOf(address)": { - "notice": "Overridden balanceOf, returning a value depending on the flow rate of the owner" - }, - "getPaymentOptionFor(address)": { - "notice": "match the owner to a PaymentOption" - }, - "getPaymentOptions()": { - "notice": "get all configured PaymentOptions" - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "notice": "Initializes the contract setting the given PaymentOptions" - }, - "isDeprecated(uint256)": { - "notice": "Check if the flow is considered deprecated based on the lastUpdated value" - }, - "ownerOf(uint256)": { - "notice": "Overridden ownerOf, determines the owner, depending flow rate" - }, - "removePaymentOption(uint256)": { - "notice": "remove an existing PaymentOption" - }, - "safeTransferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "This NFT is not transferable" - }, - "setDeprecatedAfter(uint256)": { - "notice": "set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated" - }, - "tokenOf(address)": { - "notice": "get the tokenId for an owner" - }, - "tokenURI(uint256)": { - "notice": "Overridden tokenURI, returning the URI set at deployment" - }, - "transferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - } - }, - "notice": "Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 138, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 1784, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 2057, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "51", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 329, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_name", - "offset": 0, - "slot": "101", - "type": "t_string_storage" - }, - { - "astId": 331, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_symbol", - "offset": 0, - "slot": "102", - "type": "t_string_storage" - }, - { - "astId": 335, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owners", - "offset": 0, - "slot": "103", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 339, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_balances", - "offset": 0, - "slot": "104", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 343, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_tokenApprovals", - "offset": 0, - "slot": "105", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 349, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_operatorApprovals", - "offset": 0, - "slot": "106", - "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" - }, - { - "astId": 1251, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "107", - "type": "t_array(t_uint256)44_storage" - }, - { - "astId": 10, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owner", - "offset": 0, - "slot": "151", - "type": "t_address" - }, - { - "astId": 130, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "152", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 11970, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "paymentOptions", - "offset": 0, - "slot": "201", - "type": "t_array(t_struct(PaymentOption)11951_storage)dyn_storage" - }, - { - "astId": 11972, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "baseURI", - "offset": 0, - "slot": "202", - "type": "t_string_storage" - }, - { - "astId": 11974, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "deprecatedAfter", - "offset": 0, - "slot": "203", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(PaymentOption)11951_storage)dyn_storage": { - "base": "t_struct(PaymentOption)11951_storage", - "encoding": "dynamic_array", - "label": "struct PaymentOption[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)44_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[44]", - "numberOfBytes": "1408" - }, - "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_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ISuperToken)9882": { - "encoding": "inplace", - "label": "contract ISuperToken", - "numberOfBytes": "20" - }, - "t_int96": { - "encoding": "inplace", - "label": "int96", - "numberOfBytes": "12" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,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_address)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PaymentOption)11951_storage": { - "encoding": "inplace", - "label": "struct PaymentOption", - "members": [ - { - "astId": 11946, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "incomingFlowToken", - "offset": 0, - "slot": "0", - "type": "t_contract(ISuperToken)9882" - }, - { - "astId": 11948, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "recipient", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 11950, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "requiredFlowRate", - "offset": 20, - "slot": "1", - "type": "t_int96" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimism-goerli/ExistentialNFTCloneFactory.json b/deployments/optimism-goerli/ExistentialNFTCloneFactory.json deleted file mode 100644 index fd3914b..0000000 --- a/deployments/optimism-goerli/ExistentialNFTCloneFactory.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "address": "0xFCb633f4ff90241391aD92E4678eC2a11a94a990", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExistentialNFTCloneFactory_ArgumentLengthMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "clone", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_CloneDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_ImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "baseURI", - "type": "string" - } - ], - "name": "deployClone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "name": "updateImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x1c5a56410e9082a8aca089c0c975b916567a6628fb384b1ec78f51ccdfb8a100", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0xFCb633f4ff90241391aD92E4678eC2a11a94a990", - "transactionIndex": 2, - "gasUsed": "1053343", - "logsBloom": "0x00000000000000000100000000000000000000000000000000800000000000000000000000000000000020000000000000000040000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000020000000000000000000000000000000000000000000000001000000080000000000", - "blockHash": "0x893ed52e304c0f4fa2cd2bce62b66b4e5d507de11a11740124b19af96144b2e9", - "transactionHash": "0x1c5a56410e9082a8aca089c0c975b916567a6628fb384b1ec78f51ccdfb8a100", - "logs": [ - { - "transactionIndex": 2, - "blockNumber": 14540360, - "transactionHash": "0x1c5a56410e9082a8aca089c0c975b916567a6628fb384b1ec78f51ccdfb8a100", - "address": "0xFCb633f4ff90241391aD92E4678eC2a11a94a990", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d15d5d0f5b1b56a4daef75cfe108cb825e97d015" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x893ed52e304c0f4fa2cd2bce62b66b4e5d507de11a11740124b19af96144b2e9" - } - ], - "blockNumber": 14540360, - "cumulativeGasUsed": "1121196", - "status": 1, - "byzantium": true - }, - "args": [ - "0x8054BDE640E828492b22606e076CeFb2D6a228ea" - ], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExistentialNFTCloneFactory_ArgumentLengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"clone\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_CloneDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_ImplementationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"deployClone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"name\":\"updateImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFTCloneFactory.sol\":\"ExistentialNFTCloneFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.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 Ownable is Context {\\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 constructor() {\\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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"},\"contracts/ExistentialNFTCloneFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ExistentialNFT} from \\\"./ExistentialNFT.sol\\\";\\n\\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n\\ncontract ExistentialNFTCloneFactory is Ownable {\\n using Clones for address;\\n\\n address public implementation;\\n\\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\\n event ExistentialNFTCloneFactory_ImplementationUpdated(\\n address indexed implementation\\n );\\n\\n constructor(address _implementation) Ownable() {\\n implementation = _implementation;\\n }\\n\\n function deployClone(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory baseURI\\n ) external {\\n if (\\n !(incomingFlowTokens.length > 0 &&\\n incomingFlowTokens.length == recipients.length &&\\n incomingFlowTokens.length == requiredFlowRates.length)\\n ) {\\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n }\\n\\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\\n\\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\\n\\n clone.initialize(\\n owner,\\n incomingFlowTokens,\\n recipients,\\n requiredFlowRates,\\n name,\\n symbol,\\n baseURI\\n );\\n }\\n\\n function updateImplementation(address _implementation) external onlyOwner {\\n implementation = _implementation;\\n\\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\\n }\\n}\\n\",\"keccak256\":\"0xa483c580728b807503f233cac0822460d0db44b1c535372d03cf19ee5148dd0c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200133e3803806200133e8339818101604052810190620000379190620001d5565b620000576200004b6200009f60201b60201c565b620000a760201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000207565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019d8262000170565b9050919050565b620001af8162000190565b8114620001bb57600080fd5b50565b600081519050620001cf81620001a4565b92915050565b600060208284031215620001ee57620001ed6200016b565b5b6000620001fe84828501620001be565b91505092915050565b61112780620002176000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3049, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12591, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "implementation", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimism-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json b/deployments/optimism-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json deleted file mode 100644 index e19826a..0000000 --- a/deployments/optimism-goerli/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable {\n using SuperTokenV1Library for ISuperToken;\n\n PaymentOption[] private paymentOptions;\n string private _tokenURI;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory globalTokenURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n _tokenURI = globalTokenURI;\n }\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the global URI of the NFT set at deployment\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 0 ? \"\" : _tokenURI;\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory {\n using Clones for address;\n\n address public immutable implementation;\n\n event ExistentialNFT_CloneDeployed(address indexed clone);\n\n constructor(address _implementation) {\n implementation = _implementation;\n }\n\n function deployClone(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory tokenURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFT_CloneDeployed(address(clone));\n\n clone.initialize(\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n tokenURI\n );\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/optimism-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json b/deployments/optimism-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json deleted file mode 100644 index f27b856..0000000 --- a/deployments/optimism-goerli/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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/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/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _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 unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\nerror ExistentialNFT_Deprecated(uint256 at);\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\n using SuperTokenV1Library for ISuperToken;\n using Strings for address;\n using Strings for int96;\n\n PaymentOption[] private paymentOptions;\n string private baseURI;\n uint256 private deprecatedAfter;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory _baseURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n baseURI = _baseURI;\n }\n\n __Ownable_init();\n transferOwnership(owner);\n }\n\n /**\n * @notice add a new PaymentOption\n * @param incomingFlowToken - the address of the supertoken\n * @param recipient - the address of the recipient\n * @param requiredFlowRate - the required flow rate\n */\n function addPaymentOption(\n ISuperToken incomingFlowToken,\n address recipient,\n int96 requiredFlowRate\n ) public onlyOwner {\n paymentOptions.push(\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\n );\n }\n\n /**\n * @notice remove an existing PaymentOption\n * @param index - the index of the PaymentOption to be removed\n */\n function removePaymentOption(uint256 index) public onlyOwner {\n if (index >= paymentOptions.length) {\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\n }\n\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\n paymentOptions[i] = paymentOptions[i + 1];\n }\n\n paymentOptions.pop();\n }\n\n /**\n * @notice set a time, after which subscriptions are considered deprecated\n * 0 means the NFT is never deprecated\n * @dev only the recipient of the first PaymentOption can call this function\n * @param timestamp - the timestamp after which subscriptions are deprecated\n */\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\n deprecatedAfter = timestamp;\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the tokenURI for the owner\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return \"\";\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return \"\";\n }\n\n return balanceOf(owner) == 0 ? \"\" : constructTokenURI(owner);\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return address(0);\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return address(0);\n }\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n\n /**\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\n */\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\n }\n\n /**\n * @notice construct the tokenURI for an owner\n * @param owner - the address of the owner\n * @dev add dynamic queryparamaters at the end of the baseURI.\n * @return tokenURI - the tokenURI for the owner\n */\n function constructTokenURI(\n address owner\n ) private view returns (string memory) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return\n string.concat(\n baseURI,\n \"&symbol=\",\n symbol(),\n \"&token=\",\n address(paymentOption.incomingFlowToken).toHexString(),\n \"&sender=\",\n owner.toHexString(),\n \"&recipient=\",\n paymentOption.recipient.toHexString(),\n \"&flowrate=\",\n paymentOption.requiredFlowRate.toString(),\n \"&clone=\",\n address(this).toHexString()\n );\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory is Ownable {\n using Clones for address;\n\n address public implementation;\n\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\n event ExistentialNFTCloneFactory_ImplementationUpdated(\n address indexed implementation\n );\n\n constructor(address _implementation) Ownable() {\n implementation = _implementation;\n }\n\n function deployClone(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory baseURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\n\n clone.initialize(\n owner,\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n baseURI\n );\n }\n\n function updateImplementation(address _implementation) external onlyOwner {\n implementation = _implementation;\n\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/polygon-zkevm-testnet/.chainId b/deployments/polygon-zkevm-testnet/.chainId deleted file mode 100644 index 37a71f9..0000000 --- a/deployments/polygon-zkevm-testnet/.chainId +++ /dev/null @@ -1 +0,0 @@ -1442 \ No newline at end of file diff --git a/deployments/polygon-zkevm-testnet/ExistentialNFT.json b/deployments/polygon-zkevm-testnet/ExistentialNFT.json deleted file mode 100644 index 38d860d..0000000 --- a/deployments/polygon-zkevm-testnet/ExistentialNFT.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "address": "0xAeAca63A4034D287658584BB4A8bDb7A03729A18", - "abi": [ - { - "inputs": [], - "name": "ExistentialNFT_PaymentOptionIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "ExistentialNFT_TransferIsNotAllowed", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "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": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "name": "addPaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getPaymentOptionFor", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption", - "name": "result", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPaymentOptions", - "outputs": [ - { - "components": [ - { - "internalType": "contract ISuperToken", - "name": "incomingFlowToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int96", - "name": "requiredFlowRate", - "type": "int96" - } - ], - "internalType": "struct PaymentOption[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_baseURI", - "type": "string" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "flowLastUpdated", - "type": "uint256" - } - ], - "name": "isDeprecated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "removePaymentOption", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "setDeprecatedAfter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "tokenOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x810a6c3df4e50d7a55c4518a7c8c9428925eec8f34795a1f8670703e1fe662e8", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0xAeAca63A4034D287658584BB4A8bDb7A03729A18", - "transactionIndex": 0, - "gasUsed": "3736192", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa1ae79e41b5f66e41922268d73538c559c0ee8c01cecdd80414d7a5cacfb09d4", - "transactionHash": "0x810a6c3df4e50d7a55c4518a7c8c9428925eec8f34795a1f8670703e1fe662e8", - "logs": [], - "blockNumber": 2463481, - "cumulativeGasUsed": "3736192", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ExistentialNFT_PaymentOptionIndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExistentialNFT_TransferIsNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"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\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"name\":\"addPaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"getPaymentOptionFor\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption\",\"name\":\"result\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPaymentOptions\",\"outputs\":[{\"components\":[{\"internalType\":\"contract ISuperToken\",\"name\":\"incomingFlowToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int96\",\"name\":\"requiredFlowRate\",\"type\":\"int96\"}],\"internalType\":\"struct PaymentOption[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_baseURI\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"flowLastUpdated\",\"type\":\"uint256\"}],\"name\":\"isDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removePaymentOption\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"setDeprecatedAfter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"tokenOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Superfluid Finance\",\"details\":\"Mirrors the Superfluid Checkout-Builder interface\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"}},\"kind\":\"dev\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"params\":{\"incomingFlowToken\":\"- the address of the supertoken\",\"recipient\":\"- the address of the recipient\",\"requiredFlowRate\":\"- the required flow rate\"}},\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\",\"returns\":{\"_0\":\"1 if the owner has a positive flow rate, 0 otherwise\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"getPaymentOptionFor(address)\":{\"details\":\"@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\",\"params\":{\"owner\":\"- the address of the owner\",\"result\":\", the loop is not broken, so that the last match is returned.\"},\"returns\":{\"result\":\"PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\"}},\"getPaymentOptions()\":{\"returns\":{\"_0\":\"PaymentOption[] - all configured PaymentOptions\"}},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"details\":\"Array parameters should be the same size.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"@param owner - if they have a positive flow rate, otherwise zero address\"}},\"removePaymentOption(uint256)\":{\"params\":{\"index\":\"- the index of the PaymentOption to be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setDeprecatedAfter(uint256)\":{\"details\":\"only the recipient of the first PaymentOption can call this function\",\"params\":{\"timestamp\":\"- the timestamp after which subscriptions are deprecated\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenOf(address)\":{\"details\":\"one address can own only one token\",\"params\":{\"owner\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\"}},\"tokenURI(uint256)\":{\"details\":\"See {IERC721-tokenURI}.\",\"params\":{\"tokenId\":\"- is the address of the owner\"},\"returns\":{\"_0\":\"tokenURI - the tokenURI for the owner\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPaymentOption(address,address,int96)\":{\"notice\":\"add a new PaymentOption\"},\"balanceOf(address)\":{\"notice\":\"Overridden balanceOf, returning a value depending on the flow rate of the owner\"},\"getPaymentOptionFor(address)\":{\"notice\":\"match the owner to a PaymentOption\"},\"getPaymentOptions()\":{\"notice\":\"get all configured PaymentOptions\"},\"initialize(address,address[],address[],int96[],string,string,string)\":{\"notice\":\"Initializes the contract setting the given PaymentOptions\"},\"isDeprecated(uint256)\":{\"notice\":\"Check if the flow is considered deprecated based on the lastUpdated value\"},\"ownerOf(uint256)\":{\"notice\":\"Overridden ownerOf, determines the owner, depending flow rate\"},\"removePaymentOption(uint256)\":{\"notice\":\"remove an existing PaymentOption\"},\"safeTransferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"notice\":\"This NFT is not transferable\"},\"setDeprecatedAfter(uint256)\":{\"notice\":\"set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated\"},\"tokenOf(address)\":{\"notice\":\"get the tokenId for an owner\"},\"tokenURI(uint256)\":{\"notice\":\"Overridden tokenURI, returning the URI set at deployment\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"This NFT is not transferable\"}},\"notice\":\"Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFT.sol\":\"ExistentialNFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506142e3806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb465146103d7578063b88d4fde146103f3578063c87b56dd1461040f578063e8f8f9c71461043f578063e985e9c51461045b578063f2fde38b1461048b57610158565b806370a0823114610327578063715018a6146103575780638da5cb5b1461036157806395d89b411461037f5780639e6166951461039d5780639f68e0db146103b957610158565b806342ec38e21161011557806342ec38e21461022f578063446de69a1461025f578063496810221461028f5780635b3e4970146102ab5780636352211e146102db57806365cce77e1461030b57610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806323b872dd146101f757806342842e0e14610213575b600080fd5b6101776004803603810190610172919061286a565b6104a7565b60405161018491906128b2565b60405180910390f35b610195610589565b6040516101a2919061295d565b60405180910390f35b6101c560048036038101906101c091906129b5565b61061b565b6040516101d29190612a23565b60405180910390f35b6101f560048036038101906101f09190612a6a565b610661565b005b610211600480360381019061020c9190612aaa565b610778565b005b61022d60048036038101906102289190612aaa565b6107aa565b005b61024960048036038101906102449190612afd565b6107dc565b6040516102569190612b39565b60405180910390f35b610279600480360381019061027491906129b5565b6108b8565b60405161028691906128b2565b60405180910390f35b6102a960048036038101906102a491906129b5565b6108d3565b005b6102c560048036038101906102c09190612afd565b6108e5565b6040516102d29190612c20565b60405180910390f35b6102f560048036038101906102f091906129b5565b610a70565b6040516103029190612a23565b60405180910390f35b61032560048036038101906103209190612ca5565b610b3e565b005b610341600480360381019061033c9190612afd565b610c8a565b60405161034e9190612b39565b60405180910390f35b61035f610d53565b005b610369610d67565b6040516103769190612a23565b60405180910390f35b610387610d91565b604051610394919061295d565b60405180910390f35b6103b760048036038101906103b291906129b5565b610e23565b005b6103c161109f565b6040516103ce9190612de9565b60405180910390f35b6103f160048036038101906103ec9190612e37565b6111c7565b005b61040d60048036038101906104089190612fac565b6111dd565b005b610429600480360381019061042491906129b5565b61120f565b604051610436919061295d565b60405180910390f35b6104596004803603810190610454919061331e565b611310565b005b61047560048036038101906104709190613468565b611625565b60405161048291906128b2565b60405180910390f35b6104a560048036038101906104a09190612afd565b6116b9565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061058257506105818261173c565b5b9050919050565b606060658054610598906134d7565b80601f01602080910402602001604051908101604052809291908181526020018280546105c4906134d7565b80156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b6000610626826117a6565b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061066c826117f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d39061357a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106fb611877565b73ffffffffffffffffffffffffffffffffffffffff16148061072a575061072981610724611877565b611625565b5b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107609061360c565b60405180910390fd5b610773838361187f565b505050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806107e8836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361082c5760009150506108b3565b6000610861848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b505050905061086f816108b8565b1561087f576000925050506108b3565b600161088a85610c8a565b146108965760006108ae565b8373ffffffffffffffffffffffffffffffffffffffff165b925050505b919050565b60008060cb541180156108cc575060cb5482115b9050919050565b6108db6119e4565b8060cb8190555050565b6108ed6127ae565b60005b60c980549050811015610a6a57600060c982815481106109135761091261362c565b5b90600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b8152505090506000610a2c858360200151846000015173ffffffffffffffffffffffffffffffffffffffff16611a629092919063ffffffff16565b905080600b0b8260400151600b0b13158015610a4c5750600081600b0b14155b15610a55578193505b50508080610a629061368a565b9150506108f0565b50919050565b6000808290506000610a81826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ac657600092505050610b39565b6000610afb838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610b09816108b8565b15610b1a5760009350505050610b39565b6001610b2584610c8a565b14610b31576000610b33565b825b93505050505b919050565b610b466119e4565b60c960405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055505050505050565b600080610c96836108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cda576000915050610d4e565b6000610d0f848360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b5050509050610d1d816108b8565b15610d2d57600092505050610d4e565b60008260400151600b0b13610d43576000610d46565b60015b60ff16925050505b919050565b610d5b6119e4565b610d656000611b02565b565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060668054610da0906134d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc906134d7565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b5050505050905090565b610e2b6119e4565b60c9805490508110610e69576040517f5d5022e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008190505b600160c980549050610e8191906136d2565b8110156110035760c9600182610e979190613706565b81548110610ea857610ea761362c565b5b906000526020600020906002020160c98281548110610eca57610ec961362c565b5b90600052602060002090600202016000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001820160149054906101000a9004600b0b8160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff1602179055509050508080610ffb9061368a565b915050610e6f565b5060c98054806110165761101561373a565b5b6001900381819060005260206000209060020201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a8154906bffffffffffffffffffffffff02191690555050905550565b606060c9805480602002602001604051908101604052809291908181526020016000905b828210156111be57838290600052602060002090600202016040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a9004600b0b600b0b600b0b81525050815260200190600101906110c3565b50505050905090565b6111d96111d2611877565b8383611bc8565b5050565b6040517fb47d3f4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060008290506000611221826108e5565b9050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff160361127457604051806020016040528060008152509250505061130b565b60006112a9838360200151846000015173ffffffffffffffffffffffffffffffffffffffff166119389092919063ffffffff16565b50505090506112b7816108b8565b156112d65760405180602001604052806000815250935050505061130b565b60006112e184610c8a565b146112f4576112ef83611d34565b611305565b604051806020016040528060008152505b93505050505b919050565b60008060019054906101000a900460ff161590508080156113415750600160008054906101000a900460ff1660ff16105b8061136e575061135030611e0e565b15801561136d5750600160008054906101000a900460ff1660ff16145b5b6113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a4906137db565b60405180910390fd5b60016000806101000a81548160ff021916908360ff16021790555080156113ea576001600060016101000a81548160ff0219169083151502179055505b6113f48484611e31565b60005b87518110156115b05760c960405180606001604052808a84815181106114205761141f61362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018984815181106114565761145561362c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16815260200188848151811061148c5761148b61362c565b5b6020026020010151600b0b815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a8154816bffffffffffffffffffffffff0219169083600b0b6bffffffffffffffffffffffff16021790555050508260ca908161159c919061399d565b5080806115a89061368a565b9150506113f7565b506115b9611e8e565b6115c2886116b9565b801561161b5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516116129190613ab7565b60405180910390a15b5050505050505050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6116c16119e4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172790613b44565b60405180910390fd5b61173981611b02565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117af81611ee7565b6117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e590613bb0565b60405180910390fd5b50565b6000806117fd83611f28565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590613bb0565b60405180910390fd5b80915050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166118f2836117f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080600061194988611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888989896040518463ffffffff1660e01b815260040161198993929190613bdf565b608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613c40565b809550819650829750839850505050505093509350935093565b6119ec611877565b73ffffffffffffffffffffffffffffffffffffffff16611a0a610d67565b73ffffffffffffffffffffffffffffffffffffffff1614611a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5790613cf3565b60405180910390fd5b565b600080611a6e85611f65565b9150508073ffffffffffffffffffffffffffffffffffffffff1663e6a1e8888686866040518463ffffffff1660e01b8152600401611aae93929190613bdf565b608060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190613c40565b9091925090505080925050509392505050565b6000609760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081609760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90613d5f565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2791906128b2565b60405180910390a3505050565b60606000611d41836108e5565b905060ca611d4d610d91565b611d70836000015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611d8f8673ffffffffffffffffffffffffffffffffffffffff166121a6565b611db2856020015173ffffffffffffffffffffffffffffffffffffffff166121a6565b611dc28660400151600b0b6121d3565b611de13073ffffffffffffffffffffffffffffffffffffffff166121a6565b604051602001611df79796959493929190613f22565b604051602081830303815290604052915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7790614053565b60405180910390fd5b611e8a8282612261565b5050565b600060019054906101000a900460ff16611edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed490614053565b60405180910390fd5b611ee56122d4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16611f0983611f28565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000807f65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea8375491507fb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212757600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361208a578273ffffffffffffffffffffffffffffffffffffffff166320bc44256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120879190614088565b91505b8173ffffffffffffffffffffffffffffffffffffffff1663b6d200de7fa9214cc96615e0085d3bb077758db69497dc2dce3b2b1e97bc93c3d18d83efd36040518263ffffffff1660e01b81526004016120e391906140ce565b602060405180830381865afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121249190614127565b90505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361216457612163614154565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036121a1576121a0614154565b5b915091565b60606121cc8273ffffffffffffffffffffffffffffffffffffffff16601460ff16612335565b9050919050565b6060600082126121f25760405180602001604052806000815250612229565b6040518060400160405280600181526020017f2d000000000000000000000000000000000000000000000000000000000000008152505b61223a61223584612571565b61258d565b60405160200161224b929190614183565b6040516020818303038152906040529050919050565b600060019054906101000a900460ff166122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a790614053565b60405180910390fd5b81606590816122bf919061399d565b5080606690816122cf919061399d565b505050565b600060019054906101000a900460ff16612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90614053565b60405180910390fd5b61233361232e611877565b611b02565b565b60606000600283600261234891906141a7565b6123529190613706565b67ffffffffffffffff81111561236b5761236a612e81565b5b6040519080825280601f01601f19166020018201604052801561239d5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123d5576123d461362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124395761243861362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261247991906141a7565b6124839190613706565b90505b6001811115612523577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106124c5576124c461362c565b5b1a60f81b8282815181106124dc576124db61362c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061251c906141e9565b9050612486565b5060008414612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e9061425e565b60405180910390fd5b8091505092915050565b6000808212156125845781600003612586565b815b9050919050565b60606000600161259c8461265b565b01905060008167ffffffffffffffff8111156125bb576125ba612e81565b5b6040519080825280601f01601f1916602001820160405280156125ed5781602001600182028036833780820191505090505b509050600082602001820190505b600115612650578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816126445761264361427e565b5b049450600085036125fb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106126b9577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816126af576126ae61427e565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126f6576d04ee2d6d415b85acef810000000083816126ec576126eb61427e565b5b0492506020810190505b662386f26fc10000831061272557662386f26fc10000838161271b5761271a61427e565b5b0492506010810190505b6305f5e100831061274e576305f5e10083816127445761274361427e565b5b0492506008810190505b61271083106127735761271083816127695761276861427e565b5b0492506004810190505b60648310612796576064838161278c5761278b61427e565b5b0492506002810190505b600a83106127a5576001810190505b80915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000600b0b81525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61284781612812565b811461285257600080fd5b50565b6000813590506128648161283e565b92915050565b6000602082840312156128805761287f612808565b5b600061288e84828501612855565b91505092915050565b60008115159050919050565b6128ac81612897565b82525050565b60006020820190506128c760008301846128a3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129075780820151818401526020810190506128ec565b60008484015250505050565b6000601f19601f8301169050919050565b600061292f826128cd565b61293981856128d8565b93506129498185602086016128e9565b61295281612913565b840191505092915050565b600060208201905081810360008301526129778184612924565b905092915050565b6000819050919050565b6129928161297f565b811461299d57600080fd5b50565b6000813590506129af81612989565b92915050565b6000602082840312156129cb576129ca612808565b5b60006129d9848285016129a0565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a0d826129e2565b9050919050565b612a1d81612a02565b82525050565b6000602082019050612a386000830184612a14565b92915050565b612a4781612a02565b8114612a5257600080fd5b50565b600081359050612a6481612a3e565b92915050565b60008060408385031215612a8157612a80612808565b5b6000612a8f85828601612a55565b9250506020612aa0858286016129a0565b9150509250929050565b600080600060608486031215612ac357612ac2612808565b5b6000612ad186828701612a55565b9350506020612ae286828701612a55565b9250506040612af3868287016129a0565b9150509250925092565b600060208284031215612b1357612b12612808565b5b6000612b2184828501612a55565b91505092915050565b612b338161297f565b82525050565b6000602082019050612b4e6000830184612b2a565b92915050565b6000819050919050565b6000612b79612b74612b6f846129e2565b612b54565b6129e2565b9050919050565b6000612b8b82612b5e565b9050919050565b6000612b9d82612b80565b9050919050565b612bad81612b92565b82525050565b612bbc81612a02565b82525050565b600081600b0b9050919050565b612bd881612bc2565b82525050565b606082016000820151612bf46000850182612ba4565b506020820151612c076020850182612bb3565b506040820151612c1a6040850182612bcf565b50505050565b6000606082019050612c356000830184612bde565b92915050565b6000612c4682612a02565b9050919050565b612c5681612c3b565b8114612c6157600080fd5b50565b600081359050612c7381612c4d565b92915050565b612c8281612bc2565b8114612c8d57600080fd5b50565b600081359050612c9f81612c79565b92915050565b600080600060608486031215612cbe57612cbd612808565b5b6000612ccc86828701612c64565b9350506020612cdd86828701612a55565b9250506040612cee86828701612c90565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b606082016000820151612d3a6000850182612ba4565b506020820151612d4d6020850182612bb3565b506040820151612d606040850182612bcf565b50505050565b6000612d728383612d24565b60608301905092915050565b6000602082019050919050565b6000612d9682612cf8565b612da08185612d03565b9350612dab83612d14565b8060005b83811015612ddc578151612dc38882612d66565b9750612dce83612d7e565b925050600181019050612daf565b5085935050505092915050565b60006020820190508181036000830152612e038184612d8b565b905092915050565b612e1481612897565b8114612e1f57600080fd5b50565b600081359050612e3181612e0b565b92915050565b60008060408385031215612e4e57612e4d612808565b5b6000612e5c85828601612a55565b9250506020612e6d85828601612e22565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612eb982612913565b810181811067ffffffffffffffff82111715612ed857612ed7612e81565b5b80604052505050565b6000612eeb6127fe565b9050612ef78282612eb0565b919050565b600067ffffffffffffffff821115612f1757612f16612e81565b5b612f2082612913565b9050602081019050919050565b82818337600083830152505050565b6000612f4f612f4a84612efc565b612ee1565b905082815260208101848484011115612f6b57612f6a612e7c565b5b612f76848285612f2d565b509392505050565b600082601f830112612f9357612f92612e77565b5b8135612fa3848260208601612f3c565b91505092915050565b60008060008060808587031215612fc657612fc5612808565b5b6000612fd487828801612a55565b9450506020612fe587828801612a55565b9350506040612ff6878288016129a0565b925050606085013567ffffffffffffffff8111156130175761301661280d565b5b61302387828801612f7e565b91505092959194509250565b600067ffffffffffffffff82111561304a57613049612e81565b5b602082029050602081019050919050565b600080fd5b600061307361306e8461302f565b612ee1565b905080838252602082019050602084028301858111156130965761309561305b565b5b835b818110156130bf57806130ab8882612c64565b845260208401935050602081019050613098565b5050509392505050565b600082601f8301126130de576130dd612e77565b5b81356130ee848260208601613060565b91505092915050565b600067ffffffffffffffff82111561311257613111612e81565b5b602082029050602081019050919050565b6000613136613131846130f7565b612ee1565b905080838252602082019050602084028301858111156131595761315861305b565b5b835b81811015613182578061316e8882612a55565b84526020840193505060208101905061315b565b5050509392505050565b600082601f8301126131a1576131a0612e77565b5b81356131b1848260208601613123565b91505092915050565b600067ffffffffffffffff8211156131d5576131d4612e81565b5b602082029050602081019050919050565b60006131f96131f4846131ba565b612ee1565b9050808382526020820190506020840283018581111561321c5761321b61305b565b5b835b8181101561324557806132318882612c90565b84526020840193505060208101905061321e565b5050509392505050565b600082601f83011261326457613263612e77565b5b81356132748482602086016131e6565b91505092915050565b600067ffffffffffffffff82111561329857613297612e81565b5b6132a182612913565b9050602081019050919050565b60006132c16132bc8461327d565b612ee1565b9050828152602081018484840111156132dd576132dc612e7c565b5b6132e8848285612f2d565b509392505050565b600082601f83011261330557613304612e77565b5b81356133158482602086016132ae565b91505092915050565b600080600080600080600060e0888a03121561333d5761333c612808565b5b600061334b8a828b01612a55565b975050602088013567ffffffffffffffff81111561336c5761336b61280d565b5b6133788a828b016130c9565b965050604088013567ffffffffffffffff8111156133995761339861280d565b5b6133a58a828b0161318c565b955050606088013567ffffffffffffffff8111156133c6576133c561280d565b5b6133d28a828b0161324f565b945050608088013567ffffffffffffffff8111156133f3576133f261280d565b5b6133ff8a828b016132f0565b93505060a088013567ffffffffffffffff8111156134205761341f61280d565b5b61342c8a828b016132f0565b92505060c088013567ffffffffffffffff81111561344d5761344c61280d565b5b6134598a828b016132f0565b91505092959891949750929550565b6000806040838503121561347f5761347e612808565b5b600061348d85828601612a55565b925050602061349e85828601612a55565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806134ef57607f821691505b602082108103613502576135016134a8565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135646021836128d8565b915061356f82613508565b604082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b60006135f6603d836128d8565b91506136018261359a565b604082019050919050565b60006020820190508181036000830152613625816135e9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006136958261297f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036136c7576136c661365b565b5b600182019050919050565b60006136dd8261297f565b91506136e88361297f565b9250828203905081811115613700576136ff61365b565b5b92915050565b60006137118261297f565b915061371c8361297f565b92508282019050808211156137345761373361365b565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006137c5602e836128d8565b91506137d082613769565b604082019050919050565b600060208201905081810360008301526137f4816137b8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261385d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613820565b6138678683613820565b95508019841693508086168417925050509392505050565b600061389a6138956138908461297f565b612b54565b61297f565b9050919050565b6000819050919050565b6138b48361387f565b6138c86138c0826138a1565b84845461382d565b825550505050565b600090565b6138dd6138d0565b6138e88184846138ab565b505050565b5b8181101561390c576139016000826138d5565b6001810190506138ee565b5050565b601f82111561395157613922816137fb565b61392b84613810565b8101602085101561393a578190505b61394e61394685613810565b8301826138ed565b50505b505050565b600082821c905092915050565b600061397460001984600802613956565b1980831691505092915050565b600061398d8383613963565b9150826002028217905092915050565b6139a6826128cd565b67ffffffffffffffff8111156139bf576139be612e81565b5b6139c982546134d7565b6139d4828285613910565b600060209050601f831160018114613a0757600084156139f5578287015190505b6139ff8582613981565b865550613a67565b601f198416613a15866137fb565b60005b82811015613a3d57848901518255600182019150602085019450602081019050613a18565b86831015613a5a5784890151613a56601f891682613963565b8355505b6001600288020188555050505b505050505050565b6000819050919050565b600060ff82169050919050565b6000613aa1613a9c613a9784613a6f565b612b54565b613a79565b9050919050565b613ab181613a86565b82525050565b6000602082019050613acc6000830184613aa8565b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b2e6026836128d8565b9150613b3982613ad2565b604082019050919050565b60006020820190508181036000830152613b5d81613b21565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613b9a6018836128d8565b9150613ba582613b64565b602082019050919050565b60006020820190508181036000830152613bc981613b8d565b9050919050565b613bd981612b92565b82525050565b6000606082019050613bf46000830186613bd0565b613c016020830185612a14565b613c0e6040830184612a14565b949350505050565b600081519050613c2581612989565b92915050565b600081519050613c3a81612c79565b92915050565b60008060008060808587031215613c5a57613c59612808565b5b6000613c6887828801613c16565b9450506020613c7987828801613c2b565b9350506040613c8a87828801613c16565b9250506060613c9b87828801613c16565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613cdd6020836128d8565b9150613ce882613ca7565b602082019050919050565b60006020820190508181036000830152613d0c81613cd0565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613d496019836128d8565b9150613d5482613d13565b602082019050919050565b60006020820190508181036000830152613d7881613d3c565b9050919050565b600081905092915050565b60008154613d97816134d7565b613da18186613d7f565b94506001821660008114613dbc5760018114613dd157613e04565b60ff1983168652811515820286019350613e04565b613dda856137fb565b60005b83811015613dfc57815481890152600182019150602081019050613ddd565b838801955050505b50505092915050565b7f2673796d626f6c3d000000000000000000000000000000000000000000000000815250565b6000613e3e826128cd565b613e488185613d7f565b9350613e588185602086016128e9565b80840191505092915050565b7f26746f6b656e3d00000000000000000000000000000000000000000000000000815250565b7f2673656e6465723d000000000000000000000000000000000000000000000000815250565b7f26726563697069656e743d000000000000000000000000000000000000000000815250565b7f26666c6f77726174653d00000000000000000000000000000000000000000000815250565b7f26636c6f6e653d00000000000000000000000000000000000000000000000000815250565b6000613f2e828a613d8a565b9150613f3982613e0d565b600882019150613f498289613e33565b9150613f5482613e64565b600782019150613f648288613e33565b9150613f6f82613e8a565b600882019150613f7f8287613e33565b9150613f8a82613eb0565b600b82019150613f9a8286613e33565b9150613fa582613ed6565b600a82019150613fb58285613e33565b9150613fc082613efc565b600782019150613fd08284613e33565b915081905098975050505050505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061403d602b836128d8565b915061404882613fe1565b604082019050919050565b6000602082019050818103600083015261406c81614030565b9050919050565b60008151905061408281612a3e565b92915050565b60006020828403121561409e5761409d612808565b5b60006140ac84828501614073565b91505092915050565b6000819050919050565b6140c8816140b5565b82525050565b60006020820190506140e360008301846140bf565b92915050565b60006140f482612a02565b9050919050565b614104816140e9565b811461410f57600080fd5b50565b600081519050614121816140fb565b92915050565b60006020828403121561413d5761413c612808565b5b600061414b84828501614112565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061418f8285613e33565b915061419b8284613e33565b91508190509392505050565b60006141b28261297f565b91506141bd8361297f565b92508282026141cb8161297f565b915082820484148315176141e2576141e161365b565b5b5092915050565b60006141f48261297f565b9150600082036142075761420661365b565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006142486020836128d8565b915061425382614212565b602082019050919050565b600060208201905081810360008301526142778161423b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220129e71573e1a57f5e3144d021c6110663cc3a3111152ff0c47080828e77f8c2364736f6c63430008130033", - "devdoc": { - "author": "Superfluid Finance", - "details": "Mirrors the Superfluid Checkout-Builder interface", - "events": { - "Approval(address,address,uint256)": { - "details": "Emitted when `owner` enables `approved` to manage the `tokenId` token." - }, - "ApprovalForAll(address,address,bool)": { - "details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets." - }, - "Initialized(uint8)": { - "details": "Triggered when the contract has been initialized or reinitialized." - }, - "Transfer(address,address,uint256)": { - "details": "Emitted when `tokenId` token is transferred from `from` to `to`." - } - }, - "kind": "dev", - "methods": { - "addPaymentOption(address,address,int96)": { - "params": { - "incomingFlowToken": "- the address of the supertoken", - "recipient": "- the address of the recipient", - "requiredFlowRate": "- the required flow rate" - } - }, - "approve(address,uint256)": { - "details": "See {IERC721-approve}." - }, - "balanceOf(address)": { - "details": "See {IERC721-balanceOf}.", - "returns": { - "_0": "1 if the owner has a positive flow rate, 0 otherwise" - } - }, - "getApproved(uint256)": { - "details": "See {IERC721-getApproved}." - }, - "getPaymentOptionFor(address)": { - "details": "@param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned", - "params": { - "owner": "- the address of the owner", - "result": ", the loop is not broken, so that the last match is returned." - }, - "returns": { - "result": "PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption" - } - }, - "getPaymentOptions()": { - "returns": { - "_0": "PaymentOption[] - all configured PaymentOptions" - } - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "details": "Array parameters should be the same size." - }, - "isApprovedForAll(address,address)": { - "details": "See {IERC721-isApprovedForAll}." - }, - "name()": { - "details": "See {IERC721Metadata-name}." - }, - "owner()": { - "details": "Returns the address of the current owner." - }, - "ownerOf(uint256)": { - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "@param owner - if they have a positive flow rate, otherwise zero address" - } - }, - "removePaymentOption(uint256)": { - "params": { - "index": "- the index of the PaymentOption to be removed" - } - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "safeTransferFrom(address,address,uint256)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "details": "See {IERC721-safeTransferFrom}" - }, - "setApprovalForAll(address,bool)": { - "details": "See {IERC721-setApprovalForAll}." - }, - "setDeprecatedAfter(uint256)": { - "details": "only the recipient of the first PaymentOption can call this function", - "params": { - "timestamp": "- the timestamp after which subscriptions are deprecated" - } - }, - "supportsInterface(bytes4)": { - "details": "See {IERC165-supportsInterface}." - }, - "symbol()": { - "details": "See {IERC721Metadata-symbol}." - }, - "tokenOf(address)": { - "details": "one address can own only one token", - "params": { - "owner": "- is the address of the owner" - }, - "returns": { - "_0": "tokenId - the address converted to uint256, 0 if the owner has no positive flow rate" - } - }, - "tokenURI(uint256)": { - "details": "See {IERC721-tokenURI}.", - "params": { - "tokenId": "- is the address of the owner" - }, - "returns": { - "_0": "tokenURI - the tokenURI for the owner" - } - }, - "transferFrom(address,address,uint256)": { - "details": "See {IERC721-transferFrom}." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "addPaymentOption(address,address,int96)": { - "notice": "add a new PaymentOption" - }, - "balanceOf(address)": { - "notice": "Overridden balanceOf, returning a value depending on the flow rate of the owner" - }, - "getPaymentOptionFor(address)": { - "notice": "match the owner to a PaymentOption" - }, - "getPaymentOptions()": { - "notice": "get all configured PaymentOptions" - }, - "initialize(address,address[],address[],int96[],string,string,string)": { - "notice": "Initializes the contract setting the given PaymentOptions" - }, - "isDeprecated(uint256)": { - "notice": "Check if the flow is considered deprecated based on the lastUpdated value" - }, - "ownerOf(uint256)": { - "notice": "Overridden ownerOf, determines the owner, depending flow rate" - }, - "removePaymentOption(uint256)": { - "notice": "remove an existing PaymentOption" - }, - "safeTransferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - }, - "safeTransferFrom(address,address,uint256,bytes)": { - "notice": "This NFT is not transferable" - }, - "setDeprecatedAfter(uint256)": { - "notice": "set a time, after which subscriptions are considered deprecated 0 means the NFT is never deprecated" - }, - "tokenOf(address)": { - "notice": "get the tokenId for an owner" - }, - "tokenURI(uint256)": { - "notice": "Overridden tokenURI, returning the URI set at deployment" - }, - "transferFrom(address,address,uint256)": { - "notice": "This NFT is not transferable" - } - }, - "notice": "Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 138, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 1784, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 2057, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "51", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 329, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_name", - "offset": 0, - "slot": "101", - "type": "t_string_storage" - }, - { - "astId": 331, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_symbol", - "offset": 0, - "slot": "102", - "type": "t_string_storage" - }, - { - "astId": 335, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owners", - "offset": 0, - "slot": "103", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 339, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_balances", - "offset": 0, - "slot": "104", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 343, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_tokenApprovals", - "offset": 0, - "slot": "105", - "type": "t_mapping(t_uint256,t_address)" - }, - { - "astId": 349, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_operatorApprovals", - "offset": 0, - "slot": "106", - "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" - }, - { - "astId": 1251, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "107", - "type": "t_array(t_uint256)44_storage" - }, - { - "astId": 10, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "_owner", - "offset": 0, - "slot": "151", - "type": "t_address" - }, - { - "astId": 130, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "__gap", - "offset": 0, - "slot": "152", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 11970, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "paymentOptions", - "offset": 0, - "slot": "201", - "type": "t_array(t_struct(PaymentOption)11951_storage)dyn_storage" - }, - { - "astId": 11972, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "baseURI", - "offset": 0, - "slot": "202", - "type": "t_string_storage" - }, - { - "astId": 11974, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "deprecatedAfter", - "offset": 0, - "slot": "203", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(PaymentOption)11951_storage)dyn_storage": { - "base": "t_struct(PaymentOption)11951_storage", - "encoding": "dynamic_array", - "label": "struct PaymentOption[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)44_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[44]", - "numberOfBytes": "1408" - }, - "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_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ISuperToken)9882": { - "encoding": "inplace", - "label": "contract ISuperToken", - "numberOfBytes": "20" - }, - "t_int96": { - "encoding": "inplace", - "label": "int96", - "numberOfBytes": "12" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,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_address)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PaymentOption)11951_storage": { - "encoding": "inplace", - "label": "struct PaymentOption", - "members": [ - { - "astId": 11946, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "incomingFlowToken", - "offset": 0, - "slot": "0", - "type": "t_contract(ISuperToken)9882" - }, - { - "astId": 11948, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "recipient", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 11950, - "contract": "contracts/ExistentialNFT.sol:ExistentialNFT", - "label": "requiredFlowRate", - "offset": 20, - "slot": "1", - "type": "t_int96" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - } - } - } -} \ No newline at end of file diff --git a/deployments/polygon-zkevm-testnet/ExistentialNFTCloneFactory.json b/deployments/polygon-zkevm-testnet/ExistentialNFTCloneFactory.json deleted file mode 100644 index 6ff0197..0000000 --- a/deployments/polygon-zkevm-testnet/ExistentialNFTCloneFactory.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "address": "0x70bbB7a057A13070dF11d533e8f299357D778637", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExistentialNFTCloneFactory_ArgumentLengthMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "clone", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_CloneDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "ExistentialNFTCloneFactory_ImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "contract ISuperToken[]", - "name": "incomingFlowTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]" - }, - { - "internalType": "int96[]", - "name": "requiredFlowRates", - "type": "int96[]" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "baseURI", - "type": "string" - } - ], - "name": "deployClone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_implementation", - "type": "address" - } - ], - "name": "updateImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xb74147b5f4b69e5bf368c4456f272633a6d082da312240d996901a10ea1a407a", - "receipt": { - "to": null, - "from": "0xd15D5d0f5b1b56A4daEF75CfE108Cb825E97d015", - "contractAddress": "0x70bbB7a057A13070dF11d533e8f299357D778637", - "transactionIndex": 0, - "gasUsed": "1053343", - "logsBloom": "0x00000000000000000100000000000000000000000000000000800000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000008000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000002000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000080000000000", - "blockHash": "0x5f7bcdf12ae5235a600447336ec797574618c161329b218a5ef908ffbbab5fe4", - "transactionHash": "0xb74147b5f4b69e5bf368c4456f272633a6d082da312240d996901a10ea1a407a", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 2463491, - "transactionHash": "0xb74147b5f4b69e5bf368c4456f272633a6d082da312240d996901a10ea1a407a", - "address": "0x70bbB7a057A13070dF11d533e8f299357D778637", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d15d5d0f5b1b56a4daef75cfe108cb825e97d015" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x5f7bcdf12ae5235a600447336ec797574618c161329b218a5ef908ffbbab5fe4" - } - ], - "blockNumber": 2463491, - "cumulativeGasUsed": "1053343", - "status": 1, - "byzantium": true - }, - "args": [ - "0xAeAca63A4034D287658584BB4A8bDb7A03729A18" - ], - "numDeployments": 2, - "solcInputHash": "a1df3ab736bb63b9f7bf2fce61dee822", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExistentialNFTCloneFactory_ArgumentLengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"clone\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_CloneDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ExistentialNFTCloneFactory_ImplementationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"contract ISuperToken[]\",\"name\":\"incomingFlowTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"int96[]\",\"name\":\"requiredFlowRates\",\"type\":\"int96[]\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"deployClone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"}],\"name\":\"updateImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ExistentialNFTCloneFactory.sol\":\"ExistentialNFTCloneFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\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 * Emits an {Initialized} event the first time it is successfully executed.\\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 /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\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 = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\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(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721Upgradeable.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, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\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[44] private __gap;\\n}\\n\",\"keccak256\":\"0x09fa60c34ff9b067e5ad3af7719d490a12e0ca39132df6f870746eb0d32308ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0xbe63437e37e32162d5d11ea8f11a44378c092b4bcbb05b51a813fe4bf33297d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \\\"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\\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\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \\\"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or 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 _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.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 Ownable is Context {\\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 constructor() {\\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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\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(address from, address to, uint256 tokenId) 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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777Token standard as defined in the EIP.\\n *\\n * This contract uses the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\\n * token holders and recipients react to token movements by using setting implementers\\n * for the associated interfaces in said registry. See {IERC1820Registry} and\\n * {ERC1820Implementer}.\\n */\\ninterface IERC777 {\\n /**\\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\\n *\\n * Note that some additional user `data` and `operatorData` can be logged in the event.\\n */\\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\\n\\n /**\\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\\n */\\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\\n\\n /**\\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\\n */\\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\\n\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * For most token contracts, this value will equal 1.\\n */\\n function granularity() external view returns (uint256);\\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 an account (`owner`).\\n */\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * Emits an {AuthorizedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external;\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * Emits a {RevokedOperator} event.\\n *\\n * Requirements\\n *\\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external;\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * Emits a {Sent} event.\\n *\\n * Requirements\\n *\\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external;\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * Emits a {Burned} event.\\n *\\n * Requirements\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\\n\\n event Sent(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256 amount,\\n bytes data,\\n bytes operatorData\\n );\\n}\\n\",\"keccak256\":\"0x79e6094047e40d49efa3c725b7a1519e16c28c46944884b5f6d0fbe89b450f03\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _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 unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\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 unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"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\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\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 unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport {\\n ISuperfluid,\\n ISuperToken\\n} from \\\"../interfaces/superfluid/ISuperfluid.sol\\\";\\n\\nimport {\\n IConstantFlowAgreementV1\\n} from \\\"../interfaces/agreements/IConstantFlowAgreementV1.sol\\\";\\n\\nimport {\\n IInstantDistributionAgreementV1\\n} from \\\"../interfaces/agreements/IInstantDistributionAgreementV1.sol\\\";\\n\\n/**\\n * @title Library for Token Centric Interface\\n * @author Superfluid\\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\\n * of ISuperToken.\\n * Note that it is important to \\\"warm up\\\" the cache and cache the host, cfa, ida before calling,\\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\\n */\\nlibrary SuperTokenV1Library {\\n /** CFA BASE CRUD ************************************* */\\n\\n /**\\n * @dev Create flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return createFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Create flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData // userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Update flow without userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\\n internal returns (bool)\\n {\\n return updateFlow(token, receiver, flowRate, new bytes(0));\\n }\\n\\n\\n /**\\n * @dev Update flow with userData\\n * @param token The token used in flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The userdata passed along with call\\n */\\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (token, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Delete flow without userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver)\\n internal returns (bool)\\n {\\n return deleteFlow(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Delete flow with userData\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The userdata passed along with call\\n */\\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\\n internal returns (bool)\\n {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** CFA ACL ************************************* */\\n\\n /**\\n * @dev Update permissions for flow operator\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n */\\n function setFlowPermissions(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function setMaxFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n */\\n function revokeFlowPermissions(\\n ISuperToken token,\\n address flowOperator\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n new bytes(0)\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n */\\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Increases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is increased\\n * @param addedFlowRateAllowance amount to increase allowance by\\n * @param userData The userdata passed along with call\\n */\\n function increaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n */\\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\\n internal\\n returns (bool)\\n {\\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\\n }\\n\\n /**\\n * @dev Decreases the flow rate allowance for flow operator\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address whose flow rate allowance is decreased\\n * @param subtractedFlowRateAllowance amount to decrease allowance by\\n * @param userData The userdata passed along with call\\n */\\n function decreaseFlowRateAllowance(\\n ISuperToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Update permissions for flow operator in callback\\n * @notice allowing userData to be a parameter here triggered stack too deep error\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param allowCreate creation permissions\\n * @param allowCreate update permissions\\n * @param allowCreate deletion permissions\\n * @param flowRateAllowance The allowance provided to flowOperator\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bool allowCreate,\\n bool allowUpdate,\\n bool allowDelete,\\n int96 flowRateAllowance,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\\n | (allowUpdate ? 1 : 0) << 1\\n | (allowDelete ? 1 : 0) << 2;\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowOperatorPermissions,\\n (\\n token,\\n flowOperator,\\n permissionsBitmask,\\n flowRateAllowance,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - give operator max permissions\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function setMaxFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.authorizeFlowOperatorWithFullControl,\\n (\\n token,\\n flowOperator,\\n new bytes(0)\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update permissions for flow operator - revoke all permission\\n * @param token The token used in flow\\n * @param flowOperator The address given flow permissions\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowPermissionsWithCtx(\\n ISuperToken token,\\n address flowOperator,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.revokeFlowOperatorWithFullControl,\\n (token, flowOperator, new bytes(0))\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n\\n /**\\n * @dev Creates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function createFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /**\\n * @dev Updates flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate\\n ) internal returns (bool) {\\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param userData The user provided data\\n */\\n function updateFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (token, sender, receiver, flowRate, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes flow as an operator without userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver\\n ) internal returns (bool) {\\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes flow as an operator with userData\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param userData The user provided data\\n */\\n function deleteFlowFrom(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n host.callAgreement(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (token, sender, receiver, new bytes(0))\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n\\n /** CFA With CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Create flow with context and userData\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Create flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.createFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow with context\\n * @param token The token to flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowWithCtx(\\n ISuperToken token,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlow,\\n (\\n token,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Update flow by operator with context\\n * @param token The token to flow\\n * @param sender The receiver of the flow\\n * @param receiver The receiver of the flow\\n * @param flowRate The desired flowRate\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.updateFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n flowRate,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlow,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Delete flow by operator with context\\n * @param token The token to flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function deleteFlowFromWithCtx(\\n ISuperToken token,\\n address sender,\\n address receiver,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n cfa,\\n abi.encodeCall(\\n cfa.deleteFlowByOperator,\\n (\\n token,\\n sender,\\n receiver,\\n new bytes(0) // placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /** CFA VIEW FUNCTIONS ************************************* */\\n\\n /**\\n * @dev get flow rate between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return flowRate The flow rate\\n */\\n function getFlowRate(ISuperToken token, address sender, address receiver)\\n internal view returns(int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get flow info between two accounts for given token\\n * @param token The token used in flow\\n * @param sender The sender of the flow\\n * @param receiver The receiver of the flow\\n * @return lastUpdated Timestamp of flow creation or last flowrate change\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlowInfo(ISuperToken token, address sender, address receiver)\\n internal view\\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\\n }\\n\\n /**\\n * @dev get net flow rate for given account for given token\\n * @param token Super token address\\n * @param account Account to query\\n * @return flowRate The net flow rate of the account\\n */\\n function getNetFlowRate(ISuperToken token, address account)\\n internal view returns (int96 flowRate)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getNetFlow(token, account);\\n }\\n\\n /**\\n * @dev get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account to query\\n * @return lastUpdated Timestamp of the last change of the net flow\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getNetFlowInfo(ISuperToken token, address account)\\n internal view\\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getAccountFlowInfo(token, account);\\n }\\n\\n /**\\n * @dev calculate buffer for a flow rate\\n * @param token The token used in flow\\n * @param flowRate The flowrate to calculate the needed buffer for\\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\\n */\\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\\n returns (uint256 bufferAmount)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\\n }\\n\\n /**\\n * @dev get existing flow permissions\\n * @param token The token used in flow\\n * @param sender sender of a flow\\n * @param flowOperator the address we are checking permissions of for sender & token\\n * @return allowCreate is true if the flowOperator can create flows\\n * @return allowUpdate is true if the flowOperator can update flows\\n * @return allowDelete is true if the flowOperator can delete flows\\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\\n */\\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\\n internal view\\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\\n {\\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\\n uint8 permissionsBitmask;\\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\\n allowCreate = permissionsBitmask & 1 == 1;\\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\\n }\\n\\n\\n /** IDA VIEW FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Gets an index by its ID and publisher.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @return exist True if the index exists.\\n * @return indexValue Total value of the index.\\n * @return totalUnitsApproved Units of the index approved by subscribers.\\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\\n */\\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\\n internal view\\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getIndex(token, publisher, indexId);\\n }\\n\\n /**\\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param amount Amount of tokens desired to distribute.\\n * @return actualAmount Amount to be distributed with correct rounding.\\n * @return newIndexValue The index value after the distribution would be called.\\n */\\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\\n internal view\\n returns (uint256 actualAmount, uint128 newIndexValue)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.calculateDistribution(token, publisher, indexId, amount);\\n }\\n\\n /**\\n * @dev List all subscriptions of an address\\n * @param token Super token used in the indexes listed.\\n * @param subscriber Subscriber address.\\n * @return publishers Publishers of the indices.\\n * @return indexIds IDs of the indices.\\n * @return unitsList Units owned of the indices.\\n */\\n function listSubscriptions(\\n ISuperToken token,\\n address subscriber\\n )\\n internal view\\n returns (\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.listSubscriptions(token, subscriber);\\n }\\n\\n /**\\n * @dev Gets subscription by publisher, index id, and subscriber.\\n * @param token Super token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber to the index.\\n * @return exist True if the subscription exists.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\\n internal view\\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscription(token, publisher, indexId, subscriber);\\n }\\n\\n /*\\n * @dev Gets subscription by the agreement ID.\\n * @param token Super Token used with the index.\\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\\n * @return publisher Publisher of the index.\\n * @return indexId ID of the index.\\n * @return approved True if the subscription has been approved by the subscriber.\\n * @return units Units held by the subscriber\\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\\n */\\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\\n internal view\\n returns (\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n )\\n {\\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\\n return ida.getSubscriptionByID(token, agreementId);\\n }\\n\\n\\n /** IDA BASE FUNCTIONS ************************************* */\\n\\n\\n /**\\n * @dev Creates a new index.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId\\n ) internal returns (bool) {\\n return createIndex(token, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Creates a new index with userData.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function createIndex(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates an index value. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue\\n ) internal returns (bool) {\\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param userData Arbitrary user data field.\\n */\\n function updateIndexValue(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount - total number of tokens desired to be distributed \\n * NOTE in many cases, there can be some precision loss \\n This may cause a slight difference in the amount param specified and the actual amount distributed. \\n See below for math:\\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\\n It is calculated like so:\\n indexDelta = amount / totalUnits \\n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\\n * NOTE Solidity does not support floating point numbers\\n So the indexDelta will be rounded down to the nearest integer. \\n This will create a 'remainder' amount of tokens that will not be distributed \\n (we'll call this the 'distribution modulo')\\n distributionModulo = amount - indexDelta * totalUnits\\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\\n This amount is equal to the 'distributionModulo' value\\n //\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount\\n ) internal returns (bool) {\\n return distribute(token, indexId, amount, new bytes(0));\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param userData Arbitrary user data field.\\n */\\n function distribute(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return approveSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function approveSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId\\n ) internal returns (bool) {\\n return revokeSubscription(token, publisher, indexId, new bytes(0));\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param userData Arbitrary user data field.\\n */\\n function revokeSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units\\n ) internal returns (bool) {\\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param userData Arbitrary user data field.\\n */\\n function updateSubscriptionUnits(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param userData Arbitrary user data field.\\n */\\n function deleteSubscription(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber\\n ) internal returns (bool) {\\n return claim(token, publisher, indexId, subscriber, new bytes(0));\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param userData Arbitrary user data field.\\n */\\n function claim(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory userData\\n ) internal returns (bool) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n host.callAgreement(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n userData\\n );\\n return true;\\n }\\n\\n /** IDA WITH CTX FUNCTIONS ************************************* */\\n\\n /**\\n * @dev Creates a new index with ctx.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function createIndexWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.createIndex,\\n (\\n token,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\\n * Meant for usage in super app callbakcs\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\\n * @param ctx from super app callback\\n */\\n function updateIndexValueWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateIndex,\\n (\\n token,\\n indexId,\\n indexValue,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\\n * passing the new total index value, this function will increase the index value by `amount`.\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param amount Amount by which the index value should increase.\\n * @param ctx from super app callback\\n */\\n function distributeWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.distribute,\\n (\\n token,\\n indexId,\\n amount,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\\n * until the subscription is approved, but once approved, the balance will be updated with\\n * prior distributions.\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function approveSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.approveSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param ctx from super app callback\\n */\\n function revokeSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.revokeSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\\n * holds. Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be updated.\\n * @param units New number of units the subscriber holds.\\n * @param ctx from super app callback\\n */\\n function updateSubscriptionUnitsWithCtx(\\n ISuperToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.updateSubscription,\\n (\\n token,\\n indexId,\\n subscriber,\\n units,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Deletes a subscription, setting a subcriber's units to zero.\\n * Meant for usage in super apps\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address whose units are to be deleted.\\n * @param ctx from super app callback\\n */\\n function deleteSubscriptionWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.deleteSubscription,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n /**\\n * @dev Claims pending distribution. Subscription should not be approved.\\n * Meant for usage in super app callbacks\\n * @param token Super Token used with the index.\\n * @param publisher Publisher of the index.\\n * @param indexId ID of the index.\\n * @param subscriber Subscriber address that receives the claim.\\n * @param ctx from super app callback\\n */\\n function claimWithCtx(\\n ISuperToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes memory ctx\\n ) internal returns (bytes memory newCtx) {\\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\\n (newCtx, ) = host.callAgreementWithContext(\\n ida,\\n abi.encodeCall(\\n ida.claim,\\n (\\n token,\\n publisher,\\n indexId,\\n subscriber,\\n new bytes(0) // ctx placeholder\\n )\\n ),\\n \\\"0x\\\",\\n ctx\\n );\\n }\\n\\n // ************** private helpers **************\\n\\n // @note We must use hardcoded constants here because:\\n // Only direct number constants and references to such constants are supported by inline assembly.\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\\\")\\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\\\")\\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\\n // keccak256(\\\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\\\");\\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\\n\\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndCFA(ISuperToken token) private\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_CFA_SLOT, cfa)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\\n // to be used in state changing methods\\n function _getAndCacheHostAndIDA(ISuperToken token) private\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n // now that we got them and are in a transaction context, persist in storage\\n assembly {\\n // solium-disable-line\\n sstore(_HOST_SLOT, host)\\n sstore(_IDA_SLOT, ida)\\n }\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n\\n // gets the host and cfa addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndCFA(ISuperToken token) private view\\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n cfa := sload(_CFA_SLOT)\\n }\\n if (address(cfa) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(cfa) != address(0));\\n }\\n\\n // gets the host and ida addrs for the token\\n // to be used in non-state changing methods (view functions)\\n function _getHostAndIDA(ISuperToken token) private view\\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\\n {\\n // check if already in contract storage...\\n assembly { // solium-disable-line\\n host := sload(_HOST_SLOT)\\n ida := sload(_IDA_SLOT)\\n }\\n if (address(ida) == address(0)) {\\n // framework contract addrs not yet cached in storage, retrieving now...\\n if (address(host) == address(0)) {\\n host = ISuperfluid(token.getHost());\\n }\\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\\n keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\"))));\\n }\\n assert(address(host) != address(0));\\n assert(address(ida) != address(0));\\n }\\n}\\n\",\"keccak256\":\"0x332072819a5bcb7cad426fa3454e1d3be9b915bccfcdfddbece645f25c98c424\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Constant Flow Agreement interface\\n * @author Superfluid\\n */\\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\\\");\\n }\\n\\n /**\\n * @notice Get the maximum flow rate allowed with the deposit\\n * @dev The deposit is clipped and rounded down\\n * @param deposit Deposit amount used for creating the flow\\n * @return flowRate The maximum flow rate\\n */\\n function getMaximumFlowRateFromDeposit(\\n ISuperfluidToken token,\\n uint256 deposit)\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Get the deposit required for creating the flow\\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\\n * @param flowRate Flow rate to be tested\\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\\n * @custom:note \\n * - if calculated deposit (flowRate * liquidationPeriod) is less\\n * than the minimum deposit, we use the minimum deposit otherwise\\n * we use the calculated deposit\\n */\\n function getDepositRequiredForFlowRate(\\n ISuperfluidToken token,\\n int96 flowRate)\\n external view virtual\\n returns (uint256 deposit);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on host.getNow()\\n * @param account The account we are interested in\\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\\n * @return timestamp The value of host.getNow()\\n */\\n function isPatricianPeriodNow(\\n ISuperfluidToken token,\\n address account)\\n external view virtual\\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\\n\\n /**\\n * @dev Returns whether it is the patrician period based on timestamp\\n * @param account The account we are interested in\\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\\n * @return bool Whether it is currently the patrician period dictated by governance\\n */\\n function isPatricianPeriod(\\n ISuperfluidToken token,\\n address account,\\n uint256 timestamp\\n )\\n public view virtual\\n returns (bool);\\n\\n /**\\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param permissions A bitmask representation of the granted permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowOperatorPermissions(\\n ISuperfluidToken token,\\n address flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance,\\n bytes calldata ctx\\n ) \\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param addedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function increaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 addedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param subtractedFlowRateAllowance The flow rate allowance delta\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @return newCtx The new context bytes\\n */\\n function decreaseFlowRateAllowance(\\n ISuperfluidToken token,\\n address flowOperator,\\n int96 subtractedFlowRateAllowance,\\n bytes calldata ctx\\n ) external virtual returns(bytes memory newCtx);\\n\\n /**\\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function authorizeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\\n * @param token Super token address\\n * @param flowOperator The permission grantee address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function revokeFlowOperatorWithFullControl(\\n ISuperfluidToken token,\\n address flowOperator,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\\n * @param token Super token address\\n * @param sender The permission granter address\\n * @param flowOperator The permission grantee address\\n * @return flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorData(\\n ISuperfluidToken token,\\n address sender,\\n address flowOperator\\n )\\n public view virtual\\n returns (\\n bytes32 flowOperatorId,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Get flow operator using flowOperatorId\\n * @param token Super token address\\n * @param flowOperatorId The keccak256 hash of encoded string \\\"flowOperator\\\", sender and flowOperator\\n * @return permissions A bitmask representation of the granted permissions\\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n function getFlowOperatorDataByID(\\n ISuperfluidToken token,\\n bytes32 flowOperatorId\\n )\\n external view virtual\\n returns (\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @notice Create a flow betwen ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementCreated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - A deposit is taken as safety margin for the solvency agents\\n * - A extra gas fee may be taken to pay for solvency agent liquidations\\n */\\n function createFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Create a flow between sender and receiver\\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function createFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update the flow rate between ctx.msgSender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Only the flow sender may update the flow rate\\n * - Even if the flow rate is zero, the flow is not deleted\\n * from the system\\n * - Deposit amount will be adjusted accordingly\\n * - No new gas fee is charged\\n */\\n function updateFlow(\\n ISuperfluidToken token,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Update a flow between sender and receiver\\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param sender Flow sender address (has granted permissions)\\n * @param receiver Flow receiver address\\n * @param flowRate New flow rate in amount per second\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n */\\n function updateFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n int96 flowRate,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Get the flow data between `sender` and `receiver` of `token`\\n * @param token Super token address\\n * @param sender Flow receiver\\n * @param receiver Flow sender\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The amount of deposit the flow\\n * @return owedDeposit The amount of owed deposit of the flow\\n */\\n function getFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @notice Get flow data using agreementId\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return timestamp Timestamp of when the flow is updated\\n * @return flowRate The flow rate\\n * @return deposit The deposit amount of the flow\\n * @return owedDeposit The owed deposit amount of the flow\\n */\\n function getFlowByID(\\n ISuperfluidToken token,\\n bytes32 agreementId\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n /**\\n * @dev Get the aggregated flow info of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return timestamp Timestamp of when a flow was last updated for account\\n * @return flowRate The net flow rate of token for account\\n * @return deposit The sum of all deposits for account's flows\\n * @return owedDeposit The sum of all owed deposits for account's flows\\n */\\n function getAccountFlowInfo(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (\\n uint256 timestamp,\\n int96 flowRate,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @dev Get the net flow rate of the account\\n * @param token Super token address\\n * @param account Account for the query\\n * @return flowRate Net flow rate\\n */\\n function getNetFlow(\\n ISuperfluidToken token,\\n address account\\n )\\n external view virtual\\n returns (int96 flowRate);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n *\\n * @custom:callbacks \\n * - AgreementTerminated\\n * - agreementId - can be used in getFlowByID\\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\\n *\\n * @custom:note \\n * - Both flow sender and receiver may delete the flow\\n * - If Sender account is insolvent or in critical state, a solvency agent may\\n * also terminate the agreement\\n * - Gas fee may be returned to the sender\\n */\\n function deleteFlow(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @notice Delete the flow between sender and receiver\\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\\n * @param token Super token address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n * @param receiver Flow receiver address\\n */\\n function deleteFlowByOperator(\\n ISuperfluidToken token,\\n address sender,\\n address receiver,\\n bytes calldata ctx\\n )\\n external virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Flow operator updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param flowOperator Flow operator address\\n * @param permissions Octo bitmask representation of permissions\\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\\n */\\n event FlowOperatorUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed flowOperator,\\n uint8 permissions,\\n int96 flowRateAllowance\\n );\\n\\n /**\\n * @dev Flow updated event\\n * @param token Super token address\\n * @param sender Flow sender address\\n * @param receiver Flow recipient address\\n * @param flowRate Flow rate in amount per second for this flow\\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\\n * @param userData The user provided data\\n *\\n */\\n event FlowUpdated(\\n ISuperfluidToken indexed token,\\n address indexed sender,\\n address indexed receiver,\\n int96 flowRate,\\n int256 totalSenderFlowRate,\\n int256 totalReceiverFlowRate,\\n bytes userData\\n );\\n\\n /**\\n * @dev Flow updated extension event\\n * @param flowOperator Flow operator address - the Context.msgSender\\n * @param deposit The deposit amount for the stream\\n */\\n event FlowUpdatedExtension(\\n address indexed flowOperator,\\n uint256 deposit\\n );\\n}\\n\",\"keccak256\":\"0x8a191d6f5dcdfd97e8fbbe17382fa96f51dbaddea6ed704206e7cbda5d12cc65\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"../superfluid/ISuperAgreement.sol\\\";\\nimport { ISuperfluidToken } from \\\"../superfluid/ISuperfluidToken.sol\\\";\\n\\n\\n/**\\n * @title Instant Distribution Agreement interface\\n * @author Superfluid\\n *\\n * @notice \\n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\\n * Despite knowing sha-3 collision is only theoretical.\\n * - A publisher can create a subscription to an index for any subscriber.\\n * - A subscription consists of:\\n * - The index it subscribes to.\\n * - Number of units subscribed.\\n * - An index consists of:\\n * - Current value as `uint128 indexValue`.\\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\\n * - A publisher can update an index with a new value that doesn't decrease.\\n * - A publisher can update a subscription with any number of units.\\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\\n * - A subscriber must approve the index in order to receive distributions from the publisher\\n * each time the index is updated.\\n * - The amount distributed is $$\\\\Delta{index} * units$$\\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\\n * - the subscriber approves the subscription (side effect),\\n * - the publisher updates the subscription (side effect),\\n * - the subscriber deletes the subscription even if it is never approved (side effect),\\n * - or the subscriber can explicitly claim them.\\n */\\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\\n\\n /// @dev ISuperAgreement.agreementType implementation\\n function agreementType() external override pure returns (bytes32) {\\n return keccak256(\\\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\\\");\\n }\\n\\n /**************************************************************************\\n * Index operations\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new index for the publisher\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function createIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index created event\\n * @param token Super token address\\n * @param publisher Index creator and publisher\\n * @param indexId The specified indexId of the newly created index\\n * @param userData The user provided data\\n */\\n event IndexCreated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n bytes userData);\\n\\n /**\\n * @dev Query the data of a index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @return exist Does the index exist\\n * @return indexValue Value of the current index\\n * @return totalUnitsApproved Total units approved for the index\\n * @return totalUnitsPending Total units pending approval for the index\\n */\\n function getIndex(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n uint128 indexValue,\\n uint128 totalUnitsApproved,\\n uint128 totalUnitsPending);\\n\\n /**\\n * @dev Calculate actual distribution amount\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\\n */\\n function calculateDistribution(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n uint256 amount)\\n external view\\n virtual\\n returns(\\n uint256 actualAmount,\\n uint128 newIndexValue);\\n\\n /**\\n * @dev Update index value of an index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param indexValue Value of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * None\\n */\\n function updateIndex(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint128 indexValue,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index updated event\\n * @param token Super token address\\n * @param publisher Index updater and publisher\\n * @param indexId The specified indexId of the updated index\\n * @param oldIndexValue The previous index value\\n * @param newIndexValue The updated index value\\n * @param totalUnitsPending The total units pending when the indexValue was updated\\n * @param totalUnitsApproved The total units approved when the indexValue was updated\\n * @param userData The user provided data\\n */\\n event IndexUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n uint128 oldIndexValue,\\n uint128 newIndexValue,\\n uint128 totalUnitsPending,\\n uint128 totalUnitsApproved,\\n bytes userData);\\n\\n /**\\n * @dev Distribute tokens through the index\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param amount The amount of tokens desired to be distributed\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note \\n * - This is a convenient version of updateIndex. It adds to the index\\n * a delta that equals to `amount / totalUnits`\\n * - The actual amount distributed could be obtained via\\n * `calculateDistribution`. This is due to precision error with index\\n * value and units data range\\n *\\n * @custom:callbacks \\n * None\\n */\\n function distribute(\\n ISuperfluidToken token,\\n uint32 indexId,\\n uint256 amount,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n\\n /**************************************************************************\\n * Subscription operations\\n *************************************************************************/\\n\\n /**\\n * @dev Approve the subscription of an index\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the publisher:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function approveSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index subscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The approved subscriber\\n * @param userData The user provided data\\n */\\n event IndexSubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n\\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionApproved(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @notice Revoke the subscription of an index\\n * @dev \\\"Unapproves\\\" the subscription and moves approved units to pending\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function revokeSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n /**\\n * @dev Index unsubscribed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The unsubscribed subscriber\\n * @param userData The user provided data\\n */\\n event IndexUnsubscribed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n bytes userData);\\n \\n /**\\n * @dev Subscription approved event\\n * @param token Super token address\\n * @param subscriber The approved subscriber\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param userData The user provided data\\n */\\n event SubscriptionRevoked(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n bytes userData);\\n\\n /**\\n * @dev Update the nuber of units of a subscription\\n * @param token Super token address\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @param units Number of units of the subscription\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if subscription exist\\n * - AgreementCreated callback to the subscriber:\\n * - agreementId is for the subscription\\n * - if subscription does not exist\\n * - AgreementUpdated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function updateSubscription(\\n ISuperfluidToken token,\\n uint32 indexId,\\n address subscriber,\\n uint128 units,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Index units updated event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event IndexUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint128 units,\\n bytes userData);\\n \\n /**\\n * @dev Subscription units updated event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param indexId The specified indexId\\n * @param publisher Index publisher\\n * @param units The new units amount\\n * @param userData The user provided data\\n */\\n event SubscriptionUnitsUpdated(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint128 units,\\n bytes userData);\\n\\n /**\\n * @dev Get data of a subscription\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber of the index\\n * @return exist Does the subscription exist?\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n bool exist,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @notice Get data of a subscription by agreement ID\\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\\\"publisher\\\", publisher, indexId)\\n * @param token Super token address\\n * @param agreementId The agreement ID\\n * @return publisher The publisher of the index\\n * @return indexId Id of the index\\n * @return approved Is the subscription approved?\\n * @return units Units of the suscription\\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\\n */\\n function getSubscriptionByID(\\n ISuperfluidToken token,\\n bytes32 agreementId)\\n external\\n view\\n virtual\\n returns(\\n address publisher,\\n uint32 indexId,\\n bool approved,\\n uint128 units,\\n uint256 pendingDistribution\\n );\\n\\n /**\\n * @dev List subscriptions of an user\\n * @param token Super token address\\n * @param subscriber The subscriber's address\\n * @return publishers Publishers of the subcriptions\\n * @return indexIds Indexes of the subscriptions\\n * @return unitsList Units of the subscriptions\\n */\\n function listSubscriptions(\\n ISuperfluidToken token,\\n address subscriber)\\n external\\n view\\n virtual\\n returns(\\n address[] memory publishers,\\n uint32[] memory indexIds,\\n uint128[] memory unitsList);\\n\\n /**\\n * @dev Delete the subscription of an user\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:callbacks \\n * - if the subscriber called it\\n * - AgreementTerminated callback to the publsiher:\\n * - agreementId is for the subscription\\n * - if the publisher called it\\n * - AgreementTerminated callback to the subscriber:\\n * - agreementId is for the subscription\\n */\\n function deleteSubscription(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev Claim pending distributions\\n * @param token Super token address\\n * @param publisher The publisher of the index\\n * @param indexId Id of the index\\n * @param subscriber The subscriber's address\\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\\n *\\n * @custom:note The subscription should not be approved yet\\n *\\n * @custom:callbacks \\n * - AgreementUpdated callback to the publisher:\\n * - agreementId is for the subscription\\n */\\n function claim(\\n ISuperfluidToken token,\\n address publisher,\\n uint32 indexId,\\n address subscriber,\\n bytes calldata ctx)\\n external\\n virtual\\n returns(bytes memory newCtx);\\n \\n /**\\n * @dev Index distribution claimed event\\n * @param token Super token address\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param subscriber The subscriber units updated\\n * @param amount The pending amount claimed\\n */\\n event IndexDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed publisher,\\n uint32 indexed indexId,\\n address subscriber,\\n uint256 amount);\\n \\n /**\\n * @dev Subscription distribution claimed event\\n * @param token Super token address\\n * @param subscriber The subscriber units updated\\n * @param publisher Index publisher\\n * @param indexId The specified indexId\\n * @param amount The pending amount claimed\\n */\\n event SubscriptionDistributionClaimed(\\n ISuperfluidToken indexed token,\\n address indexed subscriber,\\n address publisher,\\n uint32 indexId,\\n uint256 amount);\\n\\n}\\n\",\"keccak256\":\"0x323475a46f26c2a366d96121f40fa42385ef424a86f02437b675ac0fa5392812\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title Super app definitions library\\n * @author Superfluid\\n */\\nlibrary SuperAppDefinitions {\\n\\n /**************************************************************************\\n / App manifest config word\\n /**************************************************************************/\\n\\n /*\\n * App level is a way to allow the app to whitelist what other app it can\\n * interact with (aka. composite app feature).\\n *\\n * For more details, refer to the technical paper of superfluid protocol.\\n */\\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\\n\\n // The app is at the final level, hence it doesn't want to interact with any other app\\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\\n\\n // The app is at the second level, it may interact with other final level apps if whitelisted\\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\\n\\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\\n return uint8(configWord & APP_LEVEL_MASK);\\n }\\n\\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\\n }\\n\\n /**************************************************************************\\n / Callback implementation bit masks\\n /**************************************************************************/\\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\\n\\n /**************************************************************************\\n / App Jail Reasons\\n /**************************************************************************/\\n\\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\\n\\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\\n }\\n}\\n\\n/**\\n * @title Context definitions library\\n * @author Superfluid\\n */\\nlibrary ContextDefinitions {\\n\\n /**************************************************************************\\n / Call info\\n /**************************************************************************/\\n\\n // app level\\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\\n\\n // call type\\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\\n\\n function decodeCallInfo(uint256 callInfo)\\n internal pure\\n returns (uint8 appCallbackLevel, uint8 callType)\\n {\\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\\n internal pure\\n returns (uint256 callInfo)\\n {\\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\\n }\\n\\n}\\n\\n/**\\n * @title Flow Operator definitions library\\n * @author Superfluid\\n */\\n library FlowOperatorDefinitions {\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\\n\\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\\n return (\\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\\n ) == uint8(0);\\n }\\n }\\n\\n/**\\n * @title Batch operation library\\n * @author Superfluid\\n */\\nlibrary BatchOperation {\\n /**\\n * @dev ERC20.approve batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationApprove(\\n * abi.decode(data, (address spender, uint256 amount))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\\n /**\\n * @dev ERC20.transferFrom batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationTransferFrom(\\n * abi.decode(data, (address sender, address recipient, uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\\n /**\\n * @dev ERC777.send batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationSend(\\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\\n /**\\n * @dev ERC20.increaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationIncreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 addedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\\n /**\\n * @dev ERC20.decreaseAllowance batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDecreaseAllowance(\\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\\n /**\\n * @dev SuperToken.upgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationUpgrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\\n /**\\n * @dev SuperToken.downgrade batch operation type\\n *\\n * Call spec:\\n * ISuperToken(target).operationDowngrade(\\n * abi.decode(data, (uint256 amount)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\\n /**\\n * @dev Superfluid.callAgreement batch operation type\\n *\\n * Call spec:\\n * callAgreement(\\n * ISuperAgreement(target)),\\n * abi.decode(data, (bytes callData, bytes userData)\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\\n /**\\n * @dev Superfluid.callAppAction batch operation type\\n *\\n * Call spec:\\n * callAppAction(\\n * ISuperApp(target)),\\n * data\\n * )\\n */\\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\\n}\\n\\n/**\\n * @title Superfluid governance configs library\\n * @author Superfluid\\n */\\nlibrary SuperfluidGovernanceConfigs {\\n\\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.rewardAddress\\\");\\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\\n keccak256(\\\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\\\");\\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\\n keccak256(\\\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\\\");\\n\\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.trustedForwarder\\\",\\n forwarder));\\n }\\n\\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\\\",\\n deployer,\\n registrationKey));\\n }\\n\\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\\n {\\n return keccak256(abi.encode(\\n \\\"org.superfluid-finance.superfluid.appWhiteListing.factory\\\",\\n factory));\\n }\\n\\n function decodePPPConfig(uint256 pppConfig) internal pure\\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\\n {\\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\\n patricianPeriod = pppConfig & type(uint32).max;\\n }\\n}\\n\",\"keccak256\":\"0x2e5be80a58134c213a5fb4da40797c616a0c73cf807d5d0c49b28c5c5047a5f1\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantInflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The mint function emits the \\\"mint\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param to the flow receiver (inflow NFT receiver)\\n /// @param newTokenId the new token id\\n function mint(address to, uint256 newTokenId) external;\\n\\n /// @notice This burn function emits the \\\"burn\\\" `Transfer` event.\\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\\n /// is to inform clients that search for events.\\n /// @param tokenId desired token id to burn\\n function burn(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6c45e56bafabb2d0b61be9c9b5c40ce16f06537b7f7d695115ba995d8e384c7d\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { IFlowNFTBase } from \\\"./IFlowNFTBase.sol\\\";\\n\\ninterface IConstantOutflowNFT is IFlowNFTBase {\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\\n\\n\\n /**************************************************************************\\n * Write Functions\\n *************************************************************************/\\n\\n /// @notice The onCreate function is called when a new flow is created.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onUpdate function is called when a flow is updated.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n\\n /// @notice The onDelete function is called when a flow is deleted.\\n /// @param token the super token passed from the CFA (flowVars)\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\\n}\\n\",\"keccak256\":\"0x2df65c6d6e74ba92a267176b1f1661416a6d54cf56bebbdea85fccadfe6d446e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport {\\n IERC721Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\ninterface IFlowNFTBase is IERC721Metadata {\\n // FlowNFTData struct storage packing:\\n // b = bits\\n // WORD 1: | superToken | FREE\\n // | 160b | 96b\\n // WORD 2: | flowSender | FREE\\n // | 160b | 96b\\n // WORD 3: | flowReceiver | flowStartDate | FREE\\n // | 160b | 32b | 64b\\n struct FlowNFTData {\\n address superToken;\\n address flowSender;\\n address flowReceiver;\\n uint32 flowStartDate;\\n }\\n\\n /**************************************************************************\\n * Custom Errors\\n *************************************************************************/\\n\\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\\n\\n /**************************************************************************\\n * Events\\n *************************************************************************/\\n\\n /// @notice Informs third-party platforms that NFT metadata should be updated\\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\\n /// @param tokenId the id of the token that should have its metadata updated\\n event MetadataUpdate(uint256 tokenId);\\n\\n /**************************************************************************\\n * View\\n *************************************************************************/\\n\\n /// @notice An external function for querying flow data by `tokenId``\\n /// @param tokenId the token id\\n /// @return flowData the flow data associated with `tokenId`\\n function flowDataByTokenId(\\n uint256 tokenId\\n ) external view returns (FlowNFTData memory flowData);\\n\\n /// @notice An external function for computing the deterministic tokenId\\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\\n /// @param superToken the super token\\n /// @param flowSender the flow sender\\n /// @param flowReceiver the flow receiver\\n /// @return tokenId the tokenId\\n function getTokenId(\\n address superToken,\\n address flowSender,\\n address flowReceiver\\n ) external view returns (uint256);\\n\\n /**************************************************************************\\n * Write\\n *************************************************************************/\\n\\n function initialize(\\n string memory nftName,\\n string memory nftSymbol\\n ) external; // initializer;\\n\\n function triggerMetadataUpdate(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0xbdcda11e5c157e63da15d7aced71fa20858472e3d5d5dba158690109d4abdfab\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolAdminNFT {}\",\"keccak256\":\"0x4dc5784dc8c21fa4ed393add91ced5853e3f95222467b03dbaa79e60eb7cc193\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPoolMemberNFT {}\",\"keccak256\":\"0x1961a8579193d3a9cdceee56c4e8a1a888869eaac1b2ca3594616c67a25d45c8\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\n\\n/**\\n * @title Super agreement interface\\n * @author Superfluid\\n */\\ninterface ISuperAgreement {\\n\\n /**\\n * @dev Get the type of the agreement class\\n */\\n function agreementType() external view returns (bytes32);\\n\\n /**\\n * @dev Calculate the real-time balance for the account of this agreement class\\n * @param account Account the state belongs to\\n * @param time Time used for the calculation\\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\\n * @return deposit Account deposit amount of this agreement\\n * @return owedDeposit Account owed deposit amount of this agreement\\n */\\n function realtimeBalanceOf(\\n ISuperfluidToken token,\\n address account,\\n uint256 time\\n )\\n external\\n view\\n returns (\\n int256 dynamicBalance,\\n uint256 deposit,\\n uint256 owedDeposit\\n );\\n\\n}\\n\",\"keccak256\":\"0xb3701155641cb42103b206e66dcdc82c286f554189f9c9715b7146c0f1b6fbdc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\n/**\\n * @title SuperApp interface\\n * @author Superfluid\\n * @dev Be aware of the app being jailed, when the word permitted is used.\\n */\\ninterface ISuperApp {\\n\\n /**\\n * @dev Callback before a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is created.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementCreated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass\\n * arbitary information to the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function beforeAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n\\n /**\\n * @dev Callback after a new agreement is updated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Only revert with a \\\"reason\\\" is permitted.\\n */\\n function afterAgreementUpdated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Callback before a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param ctx The context data.\\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\\n * the after-hook callback.\\n *\\n * @custom:note \\n * - It will be invoked with `staticcall`, no state changes are permitted.\\n * - Revert is not permitted.\\n */\\n function beforeAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata ctx\\n )\\n external\\n view\\n returns (bytes memory cbdata);\\n\\n /**\\n * @dev Callback after a new agreement is terminated.\\n * @param superToken The super token used for the agreement.\\n * @param agreementClass The agreement class address.\\n * @param agreementId The agreementId\\n * @param agreementData The agreement data (non-compressed)\\n * @param cbdata The data returned from the before-hook callback.\\n * @param ctx The context data.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:note \\n * - State changes is permitted.\\n * - Revert is not permitted.\\n */\\n function afterAgreementTerminated(\\n ISuperToken superToken,\\n address agreementClass,\\n bytes32 agreementId,\\n bytes calldata agreementData,\\n bytes calldata cbdata,\\n bytes calldata ctx\\n )\\n external\\n returns (bytes memory newCtx);\\n}\\n\",\"keccak256\":\"0xf1d91553023a7a2db8da3352753fc59645aa4339643e02264b9c1868eb632f5e\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IConstantOutflowNFT } from \\\"./IConstantOutflowNFT.sol\\\";\\nimport { IConstantInflowNFT } from \\\"./IConstantInflowNFT.sol\\\";\\nimport { IPoolAdminNFT } from \\\"./IPoolAdminNFT.sol\\\";\\nimport { IPoolMemberNFT } from \\\"./IPoolMemberNFT.sol\\\";\\n\\n/**\\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\\n * @author Superfluid\\n */\\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\\n\\n /**\\n * @dev Initialize the contract\\n */\\n function initialize(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n string calldata n,\\n string calldata s\\n ) external;\\n\\n /**************************************************************************\\n * Immutable variables\\n *************************************************************************/\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\\n // solhint-disable-next-line func-name-mixedcase\\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\\n\\n /**************************************************************************\\n * TokenInfo & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view override(IERC777, TokenInfo) returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\\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 {_setupDecimals} is\\n * called.\\n *\\n * @custom:note SuperToken always uses 18 decimals.\\n *\\n * 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() external view override(TokenInfo) returns (uint8);\\n\\n /**************************************************************************\\n * ERC20 & ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by an account (`owner`).\\n */\\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\\n\\n /**************************************************************************\\n * ERC20\\n *************************************************************************/\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:note 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 * @custom:emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * @return Returns Success a boolean value indicating whether the operation succeeded.\\n *\\n * @custom:emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\\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 * @custom:emits an {Approval} event indicating the updated allowance.\\n *\\n * @custom:requirements \\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) external returns (bool);\\n\\n /**************************************************************************\\n * ERC777\\n *************************************************************************/\\n\\n /**\\n * @dev Returns the smallest part of the token that is not divisible. This\\n * means all token operations (creation, movement and destruction) must have\\n * amounts that are a multiple of this number.\\n *\\n * @custom:note For super token contracts, this value is always 1\\n */\\n function granularity() external view override(IERC777) returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * @dev If send or receive hooks are registered for the caller and `recipient`,\\n * the corresponding functions will be called with `data` and empty\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller's account, reducing the\\n * total supply and transfers the underlying token to the caller's account.\\n *\\n * If a send hook is registered for the caller, the corresponding function\\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - the caller must have at least `amount` tokens.\\n */\\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\\n\\n /**\\n * @dev Returns true if an account is an operator of `tokenHolder`.\\n * Operators can send and burn tokens on behalf of their owners. All\\n * accounts are their own operator.\\n *\\n * See {operatorSend} and {operatorBurn}.\\n */\\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\\n\\n /**\\n * @dev Make an account an operator of the caller.\\n *\\n * See {isOperatorFor}.\\n *\\n * @custom:emits an {AuthorizedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function authorizeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Revoke an account's operator status for the caller.\\n *\\n * See {isOperatorFor} and {defaultOperators}.\\n *\\n * @custom:emits a {RevokedOperator} event.\\n *\\n * @custom:requirements \\n * - `operator` cannot be calling address.\\n */\\n function revokeOperator(address operator) external override(IERC777);\\n\\n /**\\n * @dev Returns the list of default operators. These accounts are operators\\n * for all token holders, even if {authorizeOperator} was never called on\\n * them.\\n *\\n * This list is immutable, but individual holders may revoke these via\\n * {revokeOperator}, in which case {isOperatorFor} will return false.\\n */\\n function defaultOperators() external override(IERC777) view returns (address[] memory);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\\n * be an operator of `sender`.\\n *\\n * If send or receive hooks are registered for `sender` and `recipient`,\\n * the corresponding functions will be called with `data` and\\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\\n *\\n * @custom:emits a {Sent} event.\\n *\\n * @custom:requirements \\n * - `sender` cannot be the zero address.\\n * - `sender` must have at least `amount` tokens.\\n * - the caller must be an operator for `sender`.\\n * - `recipient` cannot be the zero address.\\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\\n * interface.\\n */\\n function operatorSend(\\n address sender,\\n address recipient,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\\n * The caller must be an operator of `account`.\\n *\\n * If a send hook is registered for `account`, the corresponding function\\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\\n *\\n * @custom:emits a {Burned} event.\\n *\\n * @custom:requirements \\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n * - the caller must be an operator for `account`.\\n */\\n function operatorBurn(\\n address account,\\n uint256 amount,\\n bytes calldata data,\\n bytes calldata operatorData\\n ) external override(IERC777);\\n\\n /**************************************************************************\\n * SuperToken custom token functions\\n *************************************************************************/\\n\\n /**\\n * @dev Mint new tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfMint(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Burn existing tokens for the account\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfBurn(\\n address account,\\n uint256 amount,\\n bytes memory userData\\n ) external;\\n\\n /**\\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\\n * spend tokens of `sender`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfTransferFrom(\\n address sender,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Give `spender`, `amount` allowance to spend the tokens of\\n * `account`.\\n *\\n * @custom:modifiers \\n * - onlySelf\\n */\\n function selfApproveFor(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n /**************************************************************************\\n * SuperToken extra functions\\n *************************************************************************/\\n\\n /**\\n * @dev Transfer all available balance from `msg.sender` to `recipient`\\n */\\n function transferAll(address recipient) external;\\n\\n /**************************************************************************\\n * ERC20 wrapping\\n *************************************************************************/\\n\\n /**\\n * @dev Return the underlying token contract\\n * @return tokenAddr Underlying token address\\n */\\n function getUnderlyingToken() external view returns(address tokenAddr);\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n */\\n function upgrade(uint256 amount) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\\n * @param to The account to receive upgraded tokens\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n * @param data User data for the TokensRecipient callback\\n *\\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\\n * function you should `approve` this contract\\n * \\n * @custom:warning\\n * - there is potential of reentrancy IF the \\\"to\\\" account is a registered ERC777 recipient.\\n * @custom:requirements \\n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\\n */\\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev Token upgrade event\\n * @param account Account where tokens are upgraded to\\n * @param amount Amount of tokens upgraded (in 18 decimals)\\n */\\n event TokenUpgraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20.\\n * @dev It will call transfer to send tokens\\n * @param amount Number of tokens to be downgraded\\n */\\n function downgrade(uint256 amount) external;\\n\\n /**\\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\\n * @param to The account to receive downgraded tokens\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n */\\n function downgradeTo(address to, uint256 amount) external;\\n\\n /**\\n * @dev Token downgrade event\\n * @param account Account whose tokens are downgraded\\n * @param amount Amount of tokens downgraded\\n */\\n event TokenDowngraded(\\n address indexed account,\\n uint256 amount\\n );\\n\\n /**************************************************************************\\n * Batch Operations\\n *************************************************************************/\\n\\n /**\\n * @dev Perform ERC20 approve by host contract.\\n * @param account The account owner to be approved.\\n * @param spender The spender of account owner's funds.\\n * @param amount Number of tokens to be approved.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationApprove(\\n address account,\\n address spender,\\n uint256 amount\\n ) external;\\n\\n function operationIncreaseAllowance(\\n address account,\\n address spender,\\n uint256 addedValue\\n ) external;\\n\\n function operationDecreaseAllowance(\\n address account,\\n address spender,\\n uint256 subtractedValue\\n ) external;\\n\\n /**\\n * @dev Perform ERC20 transferFrom by host contract.\\n * @param account The account to spend sender's funds.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationTransferFrom(\\n address account,\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external;\\n\\n /**\\n * @dev Perform ERC777 send by host contract.\\n * @param spender The account where the funds is sent from.\\n * @param recipient The recipient of the funds.\\n * @param amount Number of tokens to be transferred.\\n * @param data Arbitrary user inputted data\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationSend(\\n address spender,\\n address recipient,\\n uint256 amount,\\n bytes memory data\\n ) external;\\n\\n /**\\n * @dev Upgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be upgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationUpgrade(address account, uint256 amount) external;\\n\\n /**\\n * @dev Downgrade ERC20 to SuperToken by host contract.\\n * @param account The account to be changed.\\n * @param amount Number of tokens to be downgraded (in 18 decimals)\\n *\\n * @custom:modifiers \\n * - onlyHost\\n */\\n function operationDowngrade(address account, uint256 amount) external;\\n\\n // Flow NFT events\\n /**\\n * @dev Constant Outflow NFT proxy created event\\n * @param constantOutflowNFT constant outflow nft address\\n */\\n event ConstantOutflowNFTCreated(\\n IConstantOutflowNFT indexed constantOutflowNFT\\n );\\n\\n /**\\n * @dev Constant Inflow NFT proxy created event\\n * @param constantInflowNFT constant inflow nft address\\n */\\n event ConstantInflowNFTCreated(\\n IConstantInflowNFT indexed constantInflowNFT\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be the contract itself\\n //modifier onlySelf() virtual\\n\\n}\\n\",\"keccak256\":\"0xb8cfa2d1f1a9de1495102bac583a819a0bc746031e157d0f5fa4103d6ebe4179\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\n\\nimport {\\n IERC20,\\n ERC20WithTokenInfo\\n} from \\\"../tokens/ERC20WithTokenInfo.sol\\\";\\n\\n/**\\n * @title Super token factory interface\\n * @author Superfluid\\n */\\ninterface ISuperTokenFactory {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\\n\\n /**************************************************************************\\n * Immutable Variables\\n **************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /// @dev Initialize the contract\\n function initialize() external;\\n\\n /**\\n * @notice Get the canonical super token logic.\\n */\\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\\n\\n /**\\n * @dev Upgradability modes\\n */\\n enum Upgradability {\\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\\n NON_UPGRADABLE,\\n /// Upgradable through `host.updateSuperTokenLogic` operation\\n SEMI_UPGRADABLE,\\n /// Always using the latest super token logic\\n FULL_UPGRADABLE\\n }\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token\\n * @param underlyingToken Underlying ERC20 token\\n * @param underlyingDecimals Underlying token decimals\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n */\\n function createERC20Wrapper(\\n IERC20 underlyingToken,\\n uint8 underlyingDecimals,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\\n * @param underlyingToken Underlying ERC20 token\\n * @param upgradability Upgradability mode\\n * @param name Super token name\\n * @param symbol Super token symbol\\n * @return superToken The deployed and initialized wrapper super token\\n * NOTE:\\n * - It assumes token provide the .decimals() function\\n */\\n function createERC20Wrapper(\\n ERC20WithTokenInfo underlyingToken,\\n Upgradability upgradability,\\n string calldata name,\\n string calldata symbol\\n )\\n external\\n returns (ISuperToken superToken);\\n\\n /**\\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\\n * @param _underlyingToken Underlying ERC20 token\\n * @return ISuperToken the created supertoken\\n */\\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\\n external\\n returns (ISuperToken);\\n\\n /**\\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\\n * @dev We return from our canonical list if it already exists, otherwise we compute it\\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\\n * @param _underlyingToken Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\\n */\\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\\n external\\n view\\n returns (address superTokenAddress, bool isDeployed);\\n\\n /**\\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\\n * @dev We return the address if it exists and the zero address otherwise\\n * @param _underlyingTokenAddress Underlying ERC20 token address\\n * @return superTokenAddress Super token address\\n */\\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\\n external\\n view\\n returns (address superTokenAddress);\\n\\n /**\\n * @dev Creates a new custom super token\\n * @param customSuperTokenProxy address of the custom supertoken proxy\\n */\\n function initializeCustomSuperToken(\\n address customSuperTokenProxy\\n )\\n external;\\n\\n /**\\n * @dev Super token logic created event\\n * @param tokenLogic Token logic address\\n */\\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\\n\\n /**\\n * @dev Super token created event\\n * @param token Newly created super token address\\n */\\n event SuperTokenCreated(ISuperToken indexed token);\\n\\n /**\\n * @dev Custom super token created event\\n * @param token Newly created custom super token address\\n */\\n event CustomSuperTokenCreated(ISuperToken indexed token);\\n\\n}\",\"keccak256\":\"0x650695c87473f47c36ba57eecf57b42faa9eab3dd0be828aa0be5aeabf1f15db\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperfluidGovernance } from \\\"./ISuperfluidGovernance.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperTokenFactory } from \\\"./ISuperTokenFactory.sol\\\";\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperApp } from \\\"./ISuperApp.sol\\\";\\nimport {\\n BatchOperation,\\n ContextDefinitions,\\n FlowOperatorDefinitions,\\n SuperAppDefinitions,\\n SuperfluidGovernanceConfigs\\n} from \\\"./Definitions.sol\\\";\\nimport { TokenInfo } from \\\"../tokens/TokenInfo.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC777 } from \\\"@openzeppelin/contracts/token/ERC777/IERC777.sol\\\";\\n\\n/**\\n * @title Host interface\\n * @author Superfluid\\n * @notice This is the central contract of the system where super agreement, super app\\n * and super token features are connected.\\n *\\n * The Superfluid host contract is also the entry point for the protocol users,\\n * where batch call and meta transaction are provided for UX improvements.\\n *\\n */\\ninterface ISuperfluid {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n // Superfluid Custom Errors\\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\\n\\n // App Related Custom Errors\\n // uses SuperAppDefinitions' App Jail Reasons as _code\\n error APP_RULE(uint256 _code); // 0xa85ba64f\\n\\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\\n\\n /**************************************************************************\\n * Time\\n *\\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\\n * > Neo: Then why can't I see what happens to her?\\n * > The Oracle: We can never see past the choices we don't understand.\\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\\n *************************************************************************/\\n\\n function getNow() external view returns (uint256);\\n\\n /**************************************************************************\\n * Governance\\n *************************************************************************/\\n\\n /**\\n * @dev Get the current governance address of the Superfluid host\\n */\\n function getGovernance() external view returns(ISuperfluidGovernance governance);\\n\\n /**\\n * @dev Replace the current governance with a new one\\n */\\n function replaceGovernance(ISuperfluidGovernance newGov) external;\\n /**\\n * @dev Governance replaced event\\n * @param oldGov Address of the old governance contract\\n * @param newGov Address of the new governance contract\\n */\\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\\n\\n /**************************************************************************\\n * Agreement Whitelisting\\n *************************************************************************/\\n\\n /**\\n * @dev Register a new agreement class to the system\\n * @param agreementClassLogic Initial agreement class code\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class registered event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type registered\\n * @param code Address of the new agreement\\n */\\n event AgreementClassRegistered(bytes32 agreementType, address code);\\n\\n /**\\n * @dev Update code of an agreement class\\n * @param agreementClassLogic New code for the agreement class\\n *\\n * @custom:modifiers \\n * - onlyGovernance\\n */\\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\\n /**\\n * @notice Agreement class updated event\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param agreementType The agreement type updated\\n * @param code Address of the new agreement\\n */\\n event AgreementClassUpdated(bytes32 agreementType, address code);\\n\\n /**\\n * @notice Check if the agreement type is whitelisted\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\\n\\n /**\\n * @dev Check if the agreement class is whitelisted\\n */\\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\\n\\n /**\\n * @notice Get agreement class\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n */\\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\\n\\n /**\\n * @dev Map list of the agreement classes using a bitmap\\n * @param bitmap Agreement class bitmap\\n */\\n function mapAgreementClasses(uint256 bitmap)\\n external view\\n returns (ISuperAgreement[] memory agreementClasses);\\n\\n /**\\n * @notice Create a new bitmask by adding a agreement class to it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**\\n * @notice Create a new bitmask by removing a agreement class from it\\n * @dev agreementType is the keccak256 hash of: \\\"org.superfluid-finance.agreements..\\\"\\n * @param bitmap Agreement class bitmap\\n */\\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\\n external view\\n returns (uint256 newBitmap);\\n\\n /**************************************************************************\\n * Super Token Factory\\n **************************************************************************/\\n\\n /**\\n * @dev Get the super token factory\\n * @return factory The factory\\n */\\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\\n\\n /**\\n * @dev Get the super token factory logic (applicable to upgradable deployment)\\n * @return logic The factory logic\\n */\\n function getSuperTokenFactoryLogic() external view returns (address logic);\\n\\n /**\\n * @dev Update super token factory\\n * @param newFactory New factory logic\\n */\\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\\n /**\\n * @dev SuperToken factory updated event\\n * @param newFactory Address of the new factory\\n */\\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\\n\\n /**\\n * @notice Update the super token logic to the latest\\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\\n */\\n function updateSuperTokenLogic(ISuperToken token) external;\\n /**\\n * @dev SuperToken logic updated event\\n * @param code Address of the new SuperToken logic\\n */\\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\\n\\n /**************************************************************************\\n * App Registry\\n *************************************************************************/\\n\\n /**\\n * @dev Message sender (must be a contract) declares itself as a super app.\\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\\n * because app registration is currently governance permissioned on mainnets.\\n * @param configWord The super app manifest configuration, flags are defined in\\n * `SuperAppDefinitions`\\n */\\n function registerApp(uint256 configWord) external;\\n /**\\n * @dev App registered event\\n * @param app Address of jailed app\\n */\\n event AppRegistered(ISuperApp indexed app);\\n\\n /**\\n * @dev Message sender declares itself as a super app.\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\\n * must be the deployer account the registration key was issued for.\\n */\\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\\n\\n /**\\n * @dev Message sender (must be a contract) declares app as a super app\\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\\n */\\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\\n\\n /**\\n * @dev Query if the app is registered\\n * @param app Super app address\\n */\\n function isApp(ISuperApp app) external view returns(bool);\\n\\n /**\\n * @dev Query app callbacklevel\\n * @param app Super app address\\n */\\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\\n\\n /**\\n * @dev Get the manifest of the super app\\n * @param app Super app address\\n */\\n function getAppManifest(\\n ISuperApp app\\n )\\n external view\\n returns (\\n bool isSuperApp,\\n bool isJailed,\\n uint256 noopMask\\n );\\n\\n /**\\n * @dev Query if the app has been jailed\\n * @param app Super app address\\n */\\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\\n\\n /**\\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\\n * @param targetApp The target super app address\\n */\\n function allowCompositeApp(ISuperApp targetApp) external;\\n\\n /**\\n * @dev Query if source app is allowed to call the target app as downstream app\\n * @param app Super app address\\n * @param targetApp The target super app address\\n */\\n function isCompositeAppAllowed(\\n ISuperApp app,\\n ISuperApp targetApp\\n )\\n external view\\n returns (bool isAppAllowed);\\n\\n /**************************************************************************\\n * Agreement Framework\\n *\\n * Agreements use these function to trigger super app callbacks, updates\\n * app credit and charge gas fees.\\n *\\n * These functions can only be called by registered agreements.\\n *************************************************************************/\\n\\n /**\\n * @dev (For agreements) StaticCall the app before callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return cbdata Data returned from the callback.\\n */\\n function callAppBeforeCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory cbdata);\\n\\n /**\\n * @dev (For agreements) Call the app after callback\\n * @param app The super app.\\n * @param callData The call data sending to the super app.\\n * @param isTermination Is it a termination callback?\\n * @param ctx Current ctx, it will be validated.\\n * @return newCtx The current context of the transaction.\\n */\\n function callAppAfterCallback(\\n ISuperApp app,\\n bytes calldata callData,\\n bool isTermination,\\n bytes calldata ctx\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns(bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Create a new callback stack\\n * @param ctx The current ctx, it will be validated.\\n * @param app The super app.\\n * @param appCreditGranted App credit granted so far.\\n * @param appCreditUsed App credit used so far.\\n * @return newCtx The current context of the transaction.\\n */\\n function appCallbackPush(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 appCreditGranted,\\n int256 appCreditUsed,\\n ISuperfluidToken appCreditToken\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Pop from the current app callback stack\\n * @param ctx The ctx that was pushed before the callback stack.\\n * @param appCreditUsedDelta App credit used by the app.\\n * @return newCtx The current context of the transaction.\\n *\\n * @custom:security\\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\\n */\\n function appCallbackPop(\\n bytes calldata ctx,\\n int256 appCreditUsedDelta\\n )\\n external\\n // onlyAgreement\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Use app credit.\\n * @param ctx The current ctx, it will be validated.\\n * @param appCreditUsedMore See app credit for more details.\\n * @return newCtx The current context of the transaction.\\n */\\n function ctxUseCredit(\\n bytes calldata ctx,\\n int256 appCreditUsedMore\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev (For agreements) Jail the app.\\n * @param app The super app.\\n * @param reason Jail reason code.\\n * @return newCtx The current context of the transaction.\\n */\\n function jailApp(\\n bytes calldata ctx,\\n ISuperApp app,\\n uint256 reason\\n )\\n external\\n // onlyAgreement\\n // assertValidCtx(ctx)\\n returns (bytes memory newCtx);\\n\\n /**\\n * @dev Jail event for the app\\n * @param app Address of jailed app\\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\\n */\\n event Jail(ISuperApp indexed app, uint256 reason);\\n\\n /**************************************************************************\\n * Contextless Call Proxies\\n *\\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\\n * with agreements or apps.\\n *\\n * NOTE: The contextual call data should be generated using\\n * abi.encodeWithSelector. The context parameter should be set to \\\"0x\\\",\\n * an empty bytes array as a placeholder to be replaced by the host\\n * contract.\\n *************************************************************************/\\n\\n /**\\n * @dev Call agreement function\\n * @param agreementClass The agreement address you are calling\\n * @param callData The contextual call data with placeholder ctx\\n * @param userData Extra user data being sent to the super app callbacks\\n */\\n function callAgreement(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData\\n )\\n external\\n //cleanCtx\\n //isAgreement(agreementClass)\\n returns(bytes memory returnedData);\\n\\n /**\\n * @notice Call app action\\n * @dev Main use case is calling app action in a batch call via the host\\n * @param callData The contextual call data\\n *\\n * @custom:note See \\\"Contextless Call Proxies\\\" above for more about contextual call data.\\n */\\n function callAppAction(\\n ISuperApp app,\\n bytes calldata callData\\n )\\n external\\n //cleanCtx\\n //isAppActive(app)\\n //isValidAppAction(callData)\\n returns(bytes memory returnedData);\\n\\n /**************************************************************************\\n * Contextual Call Proxies and Context Utilities\\n *\\n * For apps, they must use context they receive to interact with\\n * agreements or apps.\\n *\\n * The context changes must be saved and returned by the apps in their\\n * callbacks always, any modification to the context will be detected and\\n * the violating app will be jailed.\\n *************************************************************************/\\n\\n /**\\n * @dev Context Struct\\n *\\n * @custom:note on backward compatibility:\\n * - Non-dynamic fields are padded to 32bytes and packed\\n * - Dynamic fields are referenced through a 32bytes offset to their \\\"parents\\\" field (or root)\\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\\n * - non-dynamic fields will be parsed at the same memory location,\\n * - and dynamic fields will simply have a greater offset than it was.\\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\\n */\\n struct Context {\\n //\\n // Call context\\n //\\n // app callback level\\n uint8 appCallbackLevel;\\n // type of call\\n uint8 callType;\\n // the system timestamp\\n uint256 timestamp;\\n // The intended message sender for the call\\n address msgSender;\\n\\n //\\n // Callback context\\n //\\n // For callbacks it is used to know which agreement function selector is called\\n bytes4 agreementSelector;\\n // User provided data for app callbacks\\n bytes userData;\\n\\n //\\n // App context\\n //\\n // app credit granted\\n uint256 appCreditGranted;\\n // app credit wanted by the app callback\\n uint256 appCreditWantedDeprecated;\\n // app credit used, allowing negative values over a callback session\\n // the appCreditUsed value over a callback sessions is calculated with:\\n // existing flow data owed deposit + sum of the callback agreements\\n // deposit deltas \\n // the final value used to modify the state is determined by the\\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \\n // the appCreditUsed value reached in the callback session and the app\\n // credit granted\\n int256 appCreditUsed;\\n // app address\\n address appAddress;\\n // app credit in super token\\n ISuperfluidToken appCreditToken;\\n }\\n\\n function callAgreementWithContext(\\n ISuperAgreement agreementClass,\\n bytes calldata callData,\\n bytes calldata userData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // onlyAgreement(agreementClass)\\n returns (bytes memory newCtx, bytes memory returnedData);\\n\\n function callAppActionWithContext(\\n ISuperApp app,\\n bytes calldata callData,\\n bytes calldata ctx\\n )\\n external\\n // requireValidCtx(ctx)\\n // isAppActive(app)\\n returns (bytes memory newCtx);\\n\\n function decodeCtx(bytes memory ctx)\\n external pure\\n returns (Context memory context);\\n\\n function isCtxValid(bytes calldata ctx) external view returns (bool);\\n\\n /**************************************************************************\\n * Batch call\\n **************************************************************************/\\n /**\\n * @dev Batch operation data\\n */\\n struct Operation {\\n // Operation type. Defined in BatchOperation (Definitions.sol)\\n uint32 operationType;\\n // Operation target\\n address target;\\n // Data specific to the operation\\n bytes data;\\n }\\n\\n /**\\n * @dev Batch call function\\n * @param operations Array of batch operations\\n */\\n function batchCall(Operation[] calldata operations) external;\\n\\n /**\\n * @dev Batch call function for trusted forwarders (EIP-2771)\\n * @param operations Array of batch operations\\n */\\n function forwardBatchCall(Operation[] calldata operations) external;\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * TODO: turning these off because solidity-coverage doesn't like it\\n *************************************************************************/\\n\\n /* /// @dev The current superfluid context is clean.\\n modifier cleanCtx() virtual;\\n\\n /// @dev Require the ctx being valid.\\n modifier requireValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev Assert the ctx being valid.\\n modifier assertValidCtx(bytes memory ctx) virtual;\\n\\n /// @dev The agreement is a listed agreement.\\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\\n\\n // onlyGovernance\\n\\n /// @dev The msg.sender must be a listed agreement.\\n modifier onlyAgreement() virtual;\\n\\n /// @dev The app is registered and not jailed.\\n modifier isAppActive(ISuperApp app) virtual; */\\n}\\n\",\"keccak256\":\"0x60b8207b8d0bd42b66decf0def9e8ebc032ec3e1d44b348979afc6066428effc\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\nimport { ISuperToken } from \\\"./ISuperToken.sol\\\";\\nimport { ISuperfluidToken } from \\\"./ISuperfluidToken.sol\\\";\\nimport { ISuperfluid } from \\\"./ISuperfluid.sol\\\";\\n\\n\\n/**\\n * @title Superfluid governance interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidGovernance {\\n \\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\\n\\n /**\\n * @dev Replace the current governance with a new governance\\n */\\n function replaceGovernance(\\n ISuperfluid host,\\n address newGov) external;\\n\\n /**\\n * @dev Register a new agreement class\\n */\\n function registerAgreementClass(\\n ISuperfluid host,\\n address agreementClass) external;\\n\\n /**\\n * @dev Update logics of the contracts\\n *\\n * @custom:note \\n * - Because they might have inter-dependencies, it is good to have one single function to update them all\\n */\\n function updateContracts(\\n ISuperfluid host,\\n address hostNewLogic,\\n address[] calldata agreementClassNewLogics,\\n address superTokenFactoryNewLogic\\n ) external;\\n\\n /**\\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\\n */\\n function batchUpdateSuperTokenLogic(\\n ISuperfluid host,\\n ISuperToken[] calldata tokens) external;\\n \\n /**\\n * @dev Set configuration as address value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n address value\\n ) external;\\n \\n /**\\n * @dev Set configuration as uint256 value\\n */\\n function setConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key,\\n uint256 value\\n ) external;\\n\\n /**\\n * @dev Clear configuration\\n */\\n function clearConfig(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key\\n ) external;\\n\\n /**\\n * @dev Get configuration as address value\\n */\\n function getConfigAsAddress(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (address value);\\n\\n /**\\n * @dev Get configuration as uint256 value\\n */\\n function getConfigAsUint256(\\n ISuperfluid host,\\n ISuperfluidToken superToken,\\n bytes32 key) external view returns (uint256 value);\\n\\n}\\n\",\"keccak256\":\"0x63eb98b650214aff1979f13bb9b503425d0c2d7500a3f210930fe3057695df70\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { ISuperAgreement } from \\\"./ISuperAgreement.sol\\\";\\n\\n/**\\n * @title Superfluid token interface\\n * @author Superfluid\\n */\\ninterface ISuperfluidToken {\\n\\n /**************************************************************************\\n * Errors\\n *************************************************************************/\\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\\n\\n /**************************************************************************\\n * Basic information\\n *************************************************************************/\\n\\n /**\\n * @dev Get superfluid host contract address\\n */\\n function getHost() external view returns(address host);\\n\\n /**\\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\\n *\\n * @custom:note \\n * - version: 1\\n * - liquidationType key:\\n * - 0 = reward account receives reward (PIC period)\\n * - 1 = liquidator account receives reward (Pleb period)\\n * - 2 = liquidator account receives reward (Pirate period/bailout)\\n */\\n struct LiquidationTypeData {\\n uint256 version;\\n uint8 liquidationType;\\n }\\n\\n /**************************************************************************\\n * Real-time balance functions\\n *************************************************************************/\\n\\n /**\\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\\n * @param account for the query\\n * @param timestamp Time of balance\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOf(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit);\\n\\n /**\\n * @notice Calculate the realtime balance given the current host.getNow() value\\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\\n * @param account for the query\\n * @return availableBalance Real-time balance\\n * @return deposit Account deposit\\n * @return owedDeposit Account owed Deposit\\n */\\n function realtimeBalanceOfNow(\\n address account\\n )\\n external view\\n returns (\\n int256 availableBalance,\\n uint256 deposit,\\n uint256 owedDeposit,\\n uint256 timestamp);\\n\\n /**\\n * @notice Check if account is critical\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is critical (should use future)\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCritical(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is critical now (current host.getNow())\\n * @dev A critical account is when availableBalance < 0\\n * @param account The account to check\\n * @return isCritical Whether the account is critical\\n */\\n function isAccountCriticalNow(\\n address account\\n )\\n external view\\n returns(bool isCritical);\\n\\n /**\\n * @notice Check if account is solvent\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolvent(\\n address account,\\n uint256 timestamp\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Check if account is solvent now\\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\\n * @param account The account to check\\n * @return isSolvent True if the account is solvent, false otherwise\\n */\\n function isAccountSolventNow(\\n address account\\n )\\n external view\\n returns(bool isSolvent);\\n\\n /**\\n * @notice Get a list of agreements that is active for the account\\n * @dev An active agreement is one that has state for the account\\n * @param account Account to query\\n * @return activeAgreements List of accounts that have non-zero states for the account\\n */\\n function getAccountActiveAgreements(address account)\\n external view\\n returns(ISuperAgreement[] memory activeAgreements);\\n\\n\\n /**************************************************************************\\n * Super Agreement hosting functions\\n *************************************************************************/\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function createAgreement(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement created event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementCreated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Get data of the agreement\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @return data Data of the agreement\\n */\\n function getAgreementData(\\n address agreementClass,\\n bytes32 id,\\n uint dataLength\\n )\\n external view\\n returns(bytes32[] memory data);\\n\\n /**\\n * @dev Create a new agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n function updateAgreementData(\\n bytes32 id,\\n bytes32[] calldata data\\n )\\n external;\\n /**\\n * @dev Agreement updated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param data Agreement data\\n */\\n event AgreementUpdated(\\n address indexed agreementClass,\\n bytes32 id,\\n bytes32[] data\\n );\\n\\n /**\\n * @dev Close the agreement\\n * @param id Agreement ID\\n */\\n function terminateAgreement(\\n bytes32 id,\\n uint dataLength\\n )\\n external;\\n /**\\n * @dev Agreement terminated event\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n */\\n event AgreementTerminated(\\n address indexed agreementClass,\\n bytes32 id\\n );\\n\\n /**\\n * @dev Update agreement state slot\\n * @param account Account to be updated\\n *\\n * @custom:note \\n * - To clear the storage out, provide zero-ed array of intended length\\n */\\n function updateAgreementStateSlot(\\n address account,\\n uint256 slotId,\\n bytes32[] calldata slotData\\n )\\n external;\\n /**\\n * @dev Agreement account state updated event\\n * @param agreementClass Contract address of the agreement\\n * @param account Account updated\\n * @param slotId slot id of the agreement state\\n */\\n event AgreementStateUpdated(\\n address indexed agreementClass,\\n address indexed account,\\n uint256 slotId\\n );\\n\\n /**\\n * @dev Get data of the slot of the state of an agreement\\n * @param agreementClass Contract address of the agreement\\n * @param account Account to query\\n * @param slotId slot id of the state\\n * @param dataLength length of the state data\\n */\\n function getAgreementStateSlot(\\n address agreementClass,\\n address account,\\n uint256 slotId,\\n uint dataLength\\n )\\n external view\\n returns (bytes32[] memory slotData);\\n\\n /**\\n * @notice Settle balance from an account by the agreement\\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\\n * @param account Account to query.\\n * @param delta Amount of balance delta to be settled\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function settleBalance(\\n address account,\\n int256 delta\\n )\\n external;\\n\\n /**\\n * @dev Make liquidation payouts (v2)\\n * @param id Agreement ID\\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\\n * @param targetAccount Account to be liquidated\\n * @param rewardAmount The amount the rewarded account will receive\\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\\n *\\n * @custom:note \\n * - If a bailout is required (bailoutAmount > 0)\\n * - the actual reward (single deposit) goes to the executor,\\n * - while the reward account becomes the bailout account\\n * - total bailout include: bailout amount + reward amount\\n * - the targetAccount will be bailed out\\n * - If a bailout is not required\\n * - the targetAccount will pay the rewardAmount\\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\\n *\\n * @custom:modifiers \\n * - onlyAgreement\\n */\\n function makeLiquidationPayoutsV2\\n (\\n bytes32 id,\\n bytes memory liquidationTypeData,\\n address liquidatorAccount,\\n bool useDefaultRewardAccount,\\n address targetAccount,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta\\n ) external;\\n /**\\n * @dev Agreement liquidation event v2 (including agent account)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param liquidatorAccount Address of the executor of the liquidation\\n * @param targetAccount Account of the stream sender\\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\\n * @param rewardAmount The amount the reward recipient account balance should change by\\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if the agreement is liquidated during the PIC period\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\\n * - the targetAccount will pay for the rewardAmount\\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\\n * - the targetAccount will pay for the rewardAmount\\n * - if the targetAccount is insolvent\\n * - the liquidatorAccount will get the rewardAmount (single deposit)\\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\\n * - the targetAccount will receive the bailoutAmount\\n */\\n event AgreementLiquidatedV2(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed liquidatorAccount,\\n address indexed targetAccount,\\n address rewardAmountReceiver,\\n uint256 rewardAmount,\\n int256 targetAccountBalanceDelta,\\n bytes liquidationTypeData\\n );\\n\\n /**************************************************************************\\n * Function modifiers for access control and parameter validations\\n *\\n * While they cannot be explicitly stated in function definitions, they are\\n * listed in function definition comments instead for clarity.\\n *\\n * NOTE: solidity-coverage not supporting it\\n *************************************************************************/\\n\\n /// @dev The msg.sender must be host contract\\n //modifier onlyHost() virtual;\\n\\n /// @dev The msg.sender must be a listed agreement.\\n //modifier onlyAgreement() virtual;\\n\\n /**************************************************************************\\n * DEPRECATED\\n *************************************************************************/\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param rewardAccount Account that collect the reward\\n * @param rewardAmount Amount of liquidation reward\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event AgreementLiquidated(\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed rewardAccount,\\n uint256 rewardAmount\\n );\\n\\n /**\\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\\n * @param bailoutAccount Account that bailout the penalty account\\n * @param bailoutAmount Amount of account bailout\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n */\\n event Bailout(\\n address indexed bailoutAccount,\\n uint256 bailoutAmount\\n );\\n\\n /**\\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\\n * @param liquidatorAccount Account of the agent that performed the liquidation.\\n * @param agreementClass Contract address of the agreement\\n * @param id Agreement ID\\n * @param penaltyAccount Account of the agreement to be penalized\\n * @param bondAccount Account that collect the reward or bailout accounts\\n * @param rewardAmount Amount of liquidation reward\\n * @param bailoutAmount Amount of liquidation bailouot\\n *\\n * @custom:deprecated Use AgreementLiquidatedV2 instead\\n *\\n * @custom:note \\n * Reward account rule:\\n * - if bailout is equal to 0, then\\n * - the bondAccount will get the rewardAmount,\\n * - the penaltyAccount will pay for the rewardAmount.\\n * - if bailout is larger than 0, then\\n * - the liquidatorAccount will get the rewardAmouont,\\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\\n */\\n event AgreementLiquidatedBy(\\n address liquidatorAccount,\\n address indexed agreementClass,\\n bytes32 id,\\n address indexed penaltyAccount,\\n address indexed bondAccount,\\n uint256 rewardAmount,\\n uint256 bailoutAmount\\n );\\n}\\n\",\"keccak256\":\"0xa68065a8a4da8cb3755364b714b2636861a22a268f8dd82a1be7b4686a1d02fe\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { TokenInfo } from \\\"./TokenInfo.sol\\\";\\n\\n/**\\n * @title ERC20 token with token info interface\\n * @author Superfluid\\n * @dev Using abstract contract instead of interfaces because old solidity\\n * does not support interface inheriting other interfaces\\n * solhint-disable-next-line no-empty-blocks\\n *\\n */\\n// solhint-disable-next-line no-empty-blocks\\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\\n\",\"keccak256\":\"0xea22c0295f28a5e4124cc54a5324d9d9f018f322df644ab5e2b332bbf23ada74\",\"license\":\"MIT\"},\"@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >= 0.8.4;\\n\\n/**\\n * @title ERC20 token info interface\\n * @author Superfluid\\n * @dev ERC20 standard interface does not specify these functions, but\\n * often the token implementations have them.\\n */\\ninterface TokenInfo {\\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, usually a shorter version of the\\n * name.\\n */\\n function symbol() external view returns (string memory);\\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 {_setupDecimals} is\\n * called.\\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() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x873a19fc42452483280191324109a527e0b0a1c200dab28aa85dff4ad0a7d0c0\",\"license\":\"MIT\"},\"contracts/ExistentialNFT.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.19;\\n\\nimport {ERC721Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {SuperTokenV1Library} from \\\"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nerror ExistentialNFT_TransferIsNotAllowed();\\nerror ExistentialNFT_Deprecated(uint256 at);\\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n\\nstruct PaymentOption {\\n ISuperToken incomingFlowToken;\\n address recipient;\\n int96 requiredFlowRate;\\n}\\n\\n/**\\n * @author Superfluid Finance\\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\\n * @dev Mirrors the Superfluid Checkout-Builder interface\\n */\\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\\n using SuperTokenV1Library for ISuperToken;\\n using Strings for address;\\n using Strings for int96;\\n\\n PaymentOption[] private paymentOptions;\\n string private baseURI;\\n uint256 private deprecatedAfter;\\n\\n /**\\n * @notice Initializes the contract setting the given PaymentOptions\\n * @dev Array parameters should be the same size.\\n */\\n function initialize(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory _baseURI\\n ) public initializer {\\n __ERC721_init(name, symbol);\\n\\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\\n paymentOptions.push(\\n PaymentOption(\\n incomingFlowTokens[i],\\n recipients[i],\\n requiredFlowRates[i]\\n )\\n );\\n\\n baseURI = _baseURI;\\n }\\n\\n __Ownable_init();\\n transferOwnership(owner);\\n }\\n\\n /**\\n * @notice add a new PaymentOption\\n * @param incomingFlowToken - the address of the supertoken\\n * @param recipient - the address of the recipient\\n * @param requiredFlowRate - the required flow rate\\n */\\n function addPaymentOption(\\n ISuperToken incomingFlowToken,\\n address recipient,\\n int96 requiredFlowRate\\n ) public onlyOwner {\\n paymentOptions.push(\\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\\n );\\n }\\n\\n /**\\n * @notice remove an existing PaymentOption\\n * @param index - the index of the PaymentOption to be removed\\n */\\n function removePaymentOption(uint256 index) public onlyOwner {\\n if (index >= paymentOptions.length) {\\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\\n }\\n\\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\\n paymentOptions[i] = paymentOptions[i + 1];\\n }\\n\\n paymentOptions.pop();\\n }\\n\\n /**\\n * @notice set a time, after which subscriptions are considered deprecated\\n * 0 means the NFT is never deprecated\\n * @dev only the recipient of the first PaymentOption can call this function\\n * @param timestamp - the timestamp after which subscriptions are deprecated\\n */\\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\\n deprecatedAfter = timestamp;\\n }\\n\\n /**\\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\\n * @dev See {IERC721-balanceOf}.\\n * @return 1 if the owner has a positive flow rate, 0 otherwise\\n */\\n function balanceOf(address owner) public view override returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\\n }\\n\\n /**\\n * @notice Overridden tokenURI, returning the URI set at deployment\\n * @param tokenId - is the address of the owner\\n * @dev See {IERC721-tokenURI}.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override returns (string memory) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return \\\"\\\";\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return \\\"\\\";\\n }\\n\\n return balanceOf(owner) == 0 ? \\\"\\\" : constructTokenURI(owner);\\n }\\n\\n /**\\n * @notice Overridden ownerOf, determines the owner, depending flow rate\\n * @param tokenId - is the address of the owner\\n * @return @param owner - if they have a positive flow rate, otherwise zero address\\n */\\n function ownerOf(uint256 tokenId) public view override returns (address) {\\n address owner = address(uint160(tokenId));\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return address(0);\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return address(0);\\n }\\n\\n return balanceOf(owner) == 1 ? owner : address(0);\\n }\\n\\n /**\\n * @notice get the tokenId for an owner\\n * @dev one address can own only one token\\n * @param owner - is the address of the owner\\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\\n */\\n function tokenOf(address owner) public view returns (uint256) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\\n return 0;\\n }\\n\\n (uint256 lastUpdated, , , ) = paymentOption\\n .incomingFlowToken\\n .getFlowInfo(owner, paymentOption.recipient);\\n\\n if (isDeprecated(lastUpdated)) {\\n return 0;\\n }\\n\\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(address, address, uint256) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice This NFT is not transferable\\n * @dev See {IERC721-safeTransferFrom}\\n */\\n function safeTransferFrom(\\n address,\\n address,\\n uint256,\\n bytes memory\\n ) public pure override {\\n revert ExistentialNFT_TransferIsNotAllowed();\\n }\\n\\n /**\\n * @notice get all configured PaymentOptions\\n * @return PaymentOption[] - all configured PaymentOptions\\n */\\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\\n return paymentOptions;\\n }\\n\\n /**\\n * @notice match the owner to a PaymentOption\\n * @param owner - the address of the owner\\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\\n */\\n function getPaymentOptionFor(\\n address owner\\n ) public view returns (PaymentOption memory result) {\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n PaymentOption memory paymentOption = paymentOptions[i];\\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\\n owner,\\n paymentOption.recipient\\n );\\n\\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\\n result = paymentOption;\\n }\\n }\\n }\\n\\n /**\\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\\n */\\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\\n }\\n\\n /**\\n * @notice construct the tokenURI for an owner\\n * @param owner - the address of the owner\\n * @dev add dynamic queryparamaters at the end of the baseURI.\\n * @return tokenURI - the tokenURI for the owner\\n */\\n function constructTokenURI(\\n address owner\\n ) private view returns (string memory) {\\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\\n\\n return\\n string.concat(\\n baseURI,\\n \\\"&symbol=\\\",\\n symbol(),\\n \\\"&token=\\\",\\n address(paymentOption.incomingFlowToken).toHexString(),\\n \\\"&sender=\\\",\\n owner.toHexString(),\\n \\\"&recipient=\\\",\\n paymentOption.recipient.toHexString(),\\n \\\"&flowrate=\\\",\\n paymentOption.requiredFlowRate.toString(),\\n \\\"&clone=\\\",\\n address(this).toHexString()\\n );\\n }\\n}\\n\",\"keccak256\":\"0x412e65a38f30f8b76e5141f1574772fd30a8eed75526e98d4340a8b431c74c81\",\"license\":\"MIT\"},\"contracts/ExistentialNFTCloneFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {ISuperToken} from \\\"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ExistentialNFT} from \\\"./ExistentialNFT.sol\\\";\\n\\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n\\ncontract ExistentialNFTCloneFactory is Ownable {\\n using Clones for address;\\n\\n address public implementation;\\n\\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\\n event ExistentialNFTCloneFactory_ImplementationUpdated(\\n address indexed implementation\\n );\\n\\n constructor(address _implementation) Ownable() {\\n implementation = _implementation;\\n }\\n\\n function deployClone(\\n address owner,\\n ISuperToken[] memory incomingFlowTokens,\\n address[] memory recipients,\\n int96[] memory requiredFlowRates,\\n string memory name,\\n string memory symbol,\\n string memory baseURI\\n ) external {\\n if (\\n !(incomingFlowTokens.length > 0 &&\\n incomingFlowTokens.length == recipients.length &&\\n incomingFlowTokens.length == requiredFlowRates.length)\\n ) {\\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\\n }\\n\\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\\n\\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\\n\\n clone.initialize(\\n owner,\\n incomingFlowTokens,\\n recipients,\\n requiredFlowRates,\\n name,\\n symbol,\\n baseURI\\n );\\n }\\n\\n function updateImplementation(address _implementation) external onlyOwner {\\n implementation = _implementation;\\n\\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\\n }\\n}\\n\",\"keccak256\":\"0xa483c580728b807503f233cac0822460d0db44b1c535372d03cf19ee5148dd0c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200133e3803806200133e8339818101604052810190620000379190620001d5565b620000576200004b6200009f60201b60201c565b620000a760201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000207565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019d8262000170565b9050919050565b620001af8162000190565b8114620001bb57600080fd5b50565b600081519050620001cf81620001a4565b92915050565b600060208284031215620001ee57620001ed6200016b565b5b6000620001fe84828501620001be565b91505092915050565b61112780620002176000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063025b22bc146100675780635c60da1b146100835780635e59ca80146100a1578063715018a6146100bd5780638da5cb5b146100c7578063f2fde38b146100e5575b600080fd5b610081600480360381019061007c919061064a565b610101565b005b61008b610190565b6040516100989190610686565b60405180910390f35b6100bb60048036038101906100b69190610aac565b6101b6565b005b6100c5610314565b005b6100cf610328565b6040516100dc9190610686565b60405180910390f35b6100ff60048036038101906100fa919061064a565b610351565b005b6101096103d4565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f091b6fdb2f0f86cfc5b57f1ebafc05227bd3c21c3a1d5ce03920f67fa556f82560405160405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600086511180156101c8575084518651145b80156101d5575083518651145b61020b576040517f3b1387ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061024e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610452565b90508073ffffffffffffffffffffffffffffffffffffffff167f2de0b6b8dc0046438c5319be9ab58237aec1f9551c7e363d1c95ec7de0f6df6560405160405180910390a28073ffffffffffffffffffffffffffffffffffffffff1663e8f8f9c7898989898989896040518863ffffffff1660e01b81526004016102d89796959493929190610eee565b600060405180830381600087803b1580156102f257600080fd5b505af1158015610306573d6000803e3d6000fd5b505050505050505050505050565b61031c6103d4565b610326600061050c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103596103d4565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90610ff9565b60405180910390fd5b6103d18161050c565b50565b6103dc6105d0565b73ffffffffffffffffffffffffffffffffffffffff166103fa610328565b73ffffffffffffffffffffffffffffffffffffffff1614610450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044790611065565b60405180910390fd5b565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fe906110d1565b60405180910390fd5b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610617826105ec565b9050919050565b6106278161060c565b811461063257600080fd5b50565b6000813590506106448161061e565b92915050565b6000602082840312156106605761065f6105e2565b5b600061066e84828501610635565b91505092915050565b6106808161060c565b82525050565b600060208201905061069b6000830184610677565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6106ef826106a6565b810181811067ffffffffffffffff8211171561070e5761070d6106b7565b5b80604052505050565b60006107216105d8565b905061072d82826106e6565b919050565b600067ffffffffffffffff82111561074d5761074c6106b7565b5b602082029050602081019050919050565b600080fd5b600061076e8261060c565b9050919050565b61077e81610763565b811461078957600080fd5b50565b60008135905061079b81610775565b92915050565b60006107b46107af84610732565b610717565b905080838252602082019050602084028301858111156107d7576107d661075e565b5b835b8181101561080057806107ec888261078c565b8452602084019350506020810190506107d9565b5050509392505050565b600082601f83011261081f5761081e6106a1565b5b813561082f8482602086016107a1565b91505092915050565b600067ffffffffffffffff821115610853576108526106b7565b5b602082029050602081019050919050565b600061087761087284610838565b610717565b9050808382526020820190506020840283018581111561089a5761089961075e565b5b835b818110156108c357806108af8882610635565b84526020840193505060208101905061089c565b5050509392505050565b600082601f8301126108e2576108e16106a1565b5b81356108f2848260208601610864565b91505092915050565b600067ffffffffffffffff821115610916576109156106b7565b5b602082029050602081019050919050565b600081600b0b9050919050565b61093d81610927565b811461094857600080fd5b50565b60008135905061095a81610934565b92915050565b600061097361096e846108fb565b610717565b905080838252602082019050602084028301858111156109965761099561075e565b5b835b818110156109bf57806109ab888261094b565b845260208401935050602081019050610998565b5050509392505050565b600082601f8301126109de576109dd6106a1565b5b81356109ee848260208601610960565b91505092915050565b600080fd5b600067ffffffffffffffff821115610a1757610a166106b7565b5b610a20826106a6565b9050602081019050919050565b82818337600083830152505050565b6000610a4f610a4a846109fc565b610717565b905082815260208101848484011115610a6b57610a6a6109f7565b5b610a76848285610a2d565b509392505050565b600082601f830112610a9357610a926106a1565b5b8135610aa3848260208601610a3c565b91505092915050565b600080600080600080600060e0888a031215610acb57610aca6105e2565b5b6000610ad98a828b01610635565b975050602088013567ffffffffffffffff811115610afa57610af96105e7565b5b610b068a828b0161080a565b965050604088013567ffffffffffffffff811115610b2757610b266105e7565b5b610b338a828b016108cd565b955050606088013567ffffffffffffffff811115610b5457610b536105e7565b5b610b608a828b016109c9565b945050608088013567ffffffffffffffff811115610b8157610b806105e7565b5b610b8d8a828b01610a7e565b93505060a088013567ffffffffffffffff811115610bae57610bad6105e7565b5b610bba8a828b01610a7e565b92505060c088013567ffffffffffffffff811115610bdb57610bda6105e7565b5b610be78a828b01610a7e565b91505092959891949750929550565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6000610c47610c42610c3d846105ec565b610c22565b6105ec565b9050919050565b6000610c5982610c2c565b9050919050565b6000610c6b82610c4e565b9050919050565b610c7b81610c60565b82525050565b6000610c8d8383610c72565b60208301905092915050565b6000602082019050919050565b6000610cb182610bf6565b610cbb8185610c01565b9350610cc683610c12565b8060005b83811015610cf7578151610cde8882610c81565b9750610ce983610c99565b925050600181019050610cca565b5085935050505092915050565b600081519050919050565b6000819050602082019050919050565b610d288161060c565b82525050565b6000610d3a8383610d1f565b60208301905092915050565b6000602082019050919050565b6000610d5e82610d04565b610d688185610c01565b9350610d7383610d0f565b8060005b83811015610da4578151610d8b8882610d2e565b9750610d9683610d46565b925050600181019050610d77565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610de681610927565b82525050565b6000610df88383610ddd565b60208301905092915050565b6000602082019050919050565b6000610e1c82610db1565b610e268185610dbc565b9350610e3183610dcd565b8060005b83811015610e62578151610e498882610dec565b9750610e5483610e04565b925050600181019050610e35565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ea9578082015181840152602081019050610e8e565b60008484015250505050565b6000610ec082610e6f565b610eca8185610e7a565b9350610eda818560208601610e8b565b610ee3816106a6565b840191505092915050565b600060e082019050610f03600083018a610677565b8181036020830152610f158189610ca6565b90508181036040830152610f298188610d53565b90508181036060830152610f3d8187610e11565b90508181036080830152610f518186610eb5565b905081810360a0830152610f658185610eb5565b905081810360c0830152610f798184610eb5565b905098975050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610fe3602683610e7a565b9150610fee82610f87565b604082019050919050565b6000602082019050818103600083015261101281610fd6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061104f602083610e7a565b915061105a82611019565b602082019050919050565b6000602082019050818103600083015261107e81611042565b9050919050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b60006110bb601683610e7a565b91506110c682611085565b602082019050919050565b600060208201905081810360008301526110ea816110ae565b905091905056fea2646970667358221220bf633c416b5d3eed03467c42ff974323d919c7e47e8b04fb39d3ad8570b6edbd64736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3049, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12591, - "contract": "contracts/ExistentialNFTCloneFactory.sol:ExistentialNFTCloneFactory", - "label": "implementation", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/polygon-zkevm-testnet/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json b/deployments/polygon-zkevm-testnet/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json deleted file mode 100644 index e19826a..0000000 --- a/deployments/polygon-zkevm-testnet/solcInputs/5781b71c224b238cfdd853f82e3be1bd.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable {\n using SuperTokenV1Library for ISuperToken;\n\n PaymentOption[] private paymentOptions;\n string private _tokenURI;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory globalTokenURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n _tokenURI = globalTokenURI;\n }\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the global URI of the NFT set at deployment\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 0 ? \"\" : _tokenURI;\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory {\n using Clones for address;\n\n address public immutable implementation;\n\n event ExistentialNFT_CloneDeployed(address indexed clone);\n\n constructor(address _implementation) {\n implementation = _implementation;\n }\n\n function deployClone(\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory tokenURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFT_CloneDeployed(address(clone));\n\n clone.initialize(\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n tokenURI\n );\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/deployments/polygon-zkevm-testnet/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json b/deployments/polygon-zkevm-testnet/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json deleted file mode 100644 index f27b856..0000000 --- a/deployments/polygon-zkevm-testnet/solcInputs/a1df3ab736bb63b9f7bf2fce61dee822.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\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 * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\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 * Emits an {Initialized} event the first time it is successfully executed.\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 /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable 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 function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).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 = _ownerOf(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 = ERC721Upgradeable.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 or 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(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or 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(address from, address to, uint256 tokenId, bytes memory data) 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\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 _ownerOf(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 = ERC721Upgradeable.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(address to, uint256 tokenId, bytes memory data) 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, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\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 = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\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(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.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, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\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(ERC721Upgradeable.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(address owner, address operator, bool approved) 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.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 and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.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 \"../IERC721Upgradeable.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 IERC721MetadataUpgradeable is IERC721Upgradeable {\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-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/token/ERC721/IERC721Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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-upgradeable/utils/AddressUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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 (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, 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 (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or 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 _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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" - }, - "@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/introspection/ERC165Upgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" - }, - "@openzeppelin/contracts/proxy/Clones.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\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.9.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(address from, address to, uint256 tokenId, bytes calldata data) 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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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/ERC777/IERC777.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777 {\n /**\n * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n *\n * Note that some additional user `data` and `operatorData` can be logged in the event.\n */\n event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n /**\n * @dev Emitted when `operator` is made operator for `tokenHolder`.\n */\n event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n /**\n * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n */\n event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * For most token contracts, this value will equal 1.\n */\n function granularity() external view returns (uint256);\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 an account (`owner`).\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * Emits an {AuthorizedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external;\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * Emits a {RevokedOperator} event.\n *\n * Requirements\n *\n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external;\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits a {Sent} event.\n *\n * Requirements\n *\n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external;\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * Emits a {Burned} event.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external;\n\n event Sent(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 amount,\n bytes data,\n bytes operatorData\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/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/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 Math {\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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\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 unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _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 unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport {\n ISuperfluid,\n ISuperToken\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\n\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\n\nimport {\n IInstantDistributionAgreementV1\n} from \"../interfaces/agreements/IInstantDistributionAgreementV1.sol\";\n\n/**\n * @title Library for Token Centric Interface\n * @author Superfluid\n * @dev Set `using for ISuperToken` in including file, and call any of these functions on an instance\n * of ISuperToken.\n * Note that it is important to \"warm up\" the cache and cache the host, cfa, ida before calling,\n * this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected.\n */\nlibrary SuperTokenV1Library {\n /** CFA BASE CRUD ************************************* */\n\n /**\n * @dev Create flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return createFlow(token, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Create flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function createFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData // userData\n );\n return true;\n }\n\n\n /**\n * @dev Update flow without userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate)\n internal returns (bool)\n {\n return updateFlow(token, receiver, flowRate, new bytes(0));\n }\n\n\n /**\n * @dev Update flow with userData\n * @param token The token used in flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The userdata passed along with call\n */\n function updateFlow(ISuperToken token, address receiver, int96 flowRate, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (token, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Delete flow without userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlow(ISuperToken token, address sender, address receiver)\n internal returns (bool)\n {\n return deleteFlow(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Delete flow with userData\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The userdata passed along with call\n */\n function deleteFlow(ISuperToken token, address sender, address receiver, bytes memory userData)\n internal returns (bool)\n {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /** CFA ACL ************************************* */\n\n /**\n * @dev Update permissions for flow operator\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n */\n function setFlowPermissions(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (token, flowOperator, permissionsBitmask, flowRateAllowance, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function setMaxFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n */\n function revokeFlowPermissions(\n ISuperToken token,\n address flowOperator\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n new bytes(0)\n );\n return true;\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n */\n function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance)\n internal\n returns (bool)\n {\n return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Increases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is increased\n * @param addedFlowRateAllowance amount to increase allowance by\n * @param userData The userdata passed along with call\n */\n function increaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(cfa.increaseFlowRateAllowance, (token, flowOperator, addedFlowRateAllowance, new bytes(0))),\n userData\n );\n return true;\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n */\n function decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance)\n internal\n returns (bool)\n {\n return decreaseFlowRateAllowance(token, flowOperator, subtractedFlowRateAllowance, new bytes(0));\n }\n\n /**\n * @dev Decreases the flow rate allowance for flow operator\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address whose flow rate allowance is decreased\n * @param subtractedFlowRateAllowance amount to decrease allowance by\n * @param userData The userdata passed along with call\n */\n function decreaseFlowRateAllowance(\n ISuperToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.decreaseFlowRateAllowance, (token, flowOperator, subtractedFlowRateAllowance, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Update permissions for flow operator in callback\n * @notice allowing userData to be a parameter here triggered stack too deep error\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param allowCreate creation permissions\n * @param allowCreate update permissions\n * @param allowCreate deletion permissions\n * @param flowRateAllowance The allowance provided to flowOperator\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bool allowCreate,\n bool allowUpdate,\n bool allowDelete,\n int96 flowRateAllowance,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n uint8 permissionsBitmask = (allowCreate ? 1 : 0)\n | (allowUpdate ? 1 : 0) << 1\n | (allowDelete ? 1 : 0) << 2;\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissionsBitmask,\n flowRateAllowance,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - give operator max permissions\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function setMaxFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.authorizeFlowOperatorWithFullControl,\n (\n token,\n flowOperator,\n new bytes(0)\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update permissions for flow operator - revoke all permission\n * @param token The token used in flow\n * @param flowOperator The address given flow permissions\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowPermissionsWithCtx(\n ISuperToken token,\n address flowOperator,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.revokeFlowOperatorWithFullControl,\n (token, flowOperator, new bytes(0))\n ),\n \"0x\",\n ctx\n );\n }\n\n\n /**\n * @dev Creates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Creates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function createFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /**\n * @dev Updates flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate\n ) internal returns (bool) {\n return updateFlowFrom(token, sender, receiver, flowRate, new bytes(0));\n }\n\n /**\n * @dev Updates flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param userData The user provided data\n */\n function updateFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (token, sender, receiver, flowRate, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes flow as an operator without userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver\n ) internal returns (bool) {\n return deleteFlowFrom(token, sender, receiver, new bytes(0));\n }\n\n /**\n * @dev Deletes flow as an operator with userData\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param userData The user provided data\n */\n function deleteFlowFrom(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n host.callAgreement(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (token, sender, receiver, new bytes(0))\n ),\n userData\n );\n return true;\n }\n\n\n /** CFA With CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Create flow with context and userData\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Create flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow with context\n * @param token The token to flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowWithCtx(\n ISuperToken token,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlow,\n (\n token,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Update flow by operator with context\n * @param token The token to flow\n * @param sender The receiver of the flow\n * @param receiver The receiver of the flow\n * @param flowRate The desired flowRate\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowRate,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Delete flow by operator with context\n * @param token The token to flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function deleteFlowFromWithCtx(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IConstantFlowAgreementV1 cfa) = _getAndCacheHostAndCFA(token);\n (newCtx, ) = host.callAgreementWithContext(\n cfa,\n abi.encodeCall(\n cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /** CFA VIEW FUNCTIONS ************************************* */\n\n /**\n * @dev get flow rate between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowRate The flow rate\n */\n function getFlowRate(ISuperToken token, address sender, address receiver)\n internal view returns(int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (, flowRate, , ) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get flow info between two accounts for given token\n * @param token The token used in flow\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of flow creation or last flowrate change\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver)\n internal view\n returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n (lastUpdated, flowRate, deposit, owedDeposit) = cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @dev get net flow rate for given account for given token\n * @param token Super token address\n * @param account Account to query\n * @return flowRate The net flow rate of the account\n */\n function getNetFlowRate(ISuperToken token, address account)\n internal view returns (int96 flowRate)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getNetFlow(token, account);\n }\n\n /**\n * @dev get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of the last change of the net flow\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getNetFlowInfo(ISuperToken token, address account)\n internal view\n returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @dev calculate buffer for a flow rate\n * @param token The token used in flow\n * @param flowRate The flowrate to calculate the needed buffer for\n * @return bufferAmount The buffer amount based on flowRate, liquidationPeriod and minimum deposit\n */\n function getBufferAmountByFlowRate(ISuperToken token, int96 flowRate) internal view\n returns (uint256 bufferAmount)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n return cfa.getDepositRequiredForFlowRate(token, flowRate);\n }\n\n /**\n * @dev get existing flow permissions\n * @param token The token used in flow\n * @param sender sender of a flow\n * @param flowOperator the address we are checking permissions of for sender & token\n * @return allowCreate is true if the flowOperator can create flows\n * @return allowUpdate is true if the flowOperator can update flows\n * @return allowDelete is true if the flowOperator can delete flows\n * @return flowRateAllowance The flow rate allowance the flowOperator is granted (only goes down)\n */\n function getFlowPermissions(ISuperToken token, address sender, address flowOperator)\n internal view\n returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)\n {\n (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);\n uint8 permissionsBitmask;\n (, permissionsBitmask, flowRateAllowance) = cfa.getFlowOperatorData(token, sender, flowOperator);\n allowCreate = permissionsBitmask & 1 == 1;\n allowUpdate = permissionsBitmask >> 1 & 1 == 1;\n allowDelete = permissionsBitmask >> 2 & 1 == 1;\n }\n\n\n /** IDA VIEW FUNCTIONS ************************************* */\n\n\n /**\n * @dev Gets an index by its ID and publisher.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @return exist True if the index exists.\n * @return indexValue Total value of the index.\n * @return totalUnitsApproved Units of the index approved by subscribers.\n * @return totalUnitsPending Units of teh index not yet approved by subscribers.\n */\n function getIndex(ISuperToken token, address publisher, uint32 indexId)\n internal view\n returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getIndex(token, publisher, indexId);\n }\n\n /**\n * @dev Calculates the distribution amount based on the amount of tokens desired to distribute.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param amount Amount of tokens desired to distribute.\n * @return actualAmount Amount to be distributed with correct rounding.\n * @return newIndexValue The index value after the distribution would be called.\n */\n function calculateDistribution(ISuperToken token, address publisher, uint32 indexId, uint256 amount)\n internal view\n returns (uint256 actualAmount, uint128 newIndexValue)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.calculateDistribution(token, publisher, indexId, amount);\n }\n\n /**\n * @dev List all subscriptions of an address\n * @param token Super token used in the indexes listed.\n * @param subscriber Subscriber address.\n * @return publishers Publishers of the indices.\n * @return indexIds IDs of the indices.\n * @return unitsList Units owned of the indices.\n */\n function listSubscriptions(\n ISuperToken token,\n address subscriber\n )\n internal view\n returns (\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.listSubscriptions(token, subscriber);\n }\n\n /**\n * @dev Gets subscription by publisher, index id, and subscriber.\n * @param token Super token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber to the index.\n * @return exist True if the subscription exists.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscription(ISuperToken token, address publisher, uint32 indexId, address subscriber)\n internal view\n returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscription(token, publisher, indexId, subscriber);\n }\n\n /*\n * @dev Gets subscription by the agreement ID.\n * @param token Super Token used with the index.\n * @param agreementId Agreement ID, unique to the subscriber and index ID.\n * @return publisher Publisher of the index.\n * @return indexId ID of the index.\n * @return approved True if the subscription has been approved by the subscriber.\n * @return units Units held by the subscriber\n * @return pendingDistribution If not approved, the amount to be claimed on approval.\n */\n function getSubscriptionByID(ISuperToken token, bytes32 agreementId)\n internal view\n returns (\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n )\n {\n (, IInstantDistributionAgreementV1 ida) = _getHostAndIDA(token);\n return ida.getSubscriptionByID(token, agreementId);\n }\n\n\n /** IDA BASE FUNCTIONS ************************************* */\n\n\n /**\n * @dev Creates a new index.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId\n ) internal returns (bool) {\n return createIndex(token, indexId, new bytes(0));\n }\n\n /**\n * @dev Creates a new index with userData.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function createIndex(\n ISuperToken token,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates an index value. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue\n ) internal returns (bool) {\n return updateIndexValue(token, indexId, indexValue, new bytes(0));\n }\n\n /**\n * @dev Updates an index value with userData. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param userData Arbitrary user data field.\n */\n function updateIndexValue(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`. Instead of\n * passing the new total index value, you pass the amount of tokens desired to be distributed. \n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount - total number of tokens desired to be distributed \n * NOTE in many cases, there can be some precision loss \n This may cause a slight difference in the amount param specified and the actual amount distributed. \n See below for math:\n //indexDelta = amount the index will be updated by during an internal call to _updateIndex().\n It is calculated like so:\n indexDelta = amount / totalUnits \n (see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)\n * NOTE Solidity does not support floating point numbers\n So the indexDelta will be rounded down to the nearest integer. \n This will create a 'remainder' amount of tokens that will not be distributed \n (we'll call this the 'distribution modulo')\n distributionModulo = amount - indexDelta * totalUnits\n * NOTE due to rounding, there may be a small amount of tokens left in the publisher's account\n This amount is equal to the 'distributionModulo' value\n //\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount\n ) internal returns (bool) {\n return distribute(token, indexId, amount, new bytes(0));\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex` (w user data). Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param userData Arbitrary user data field.\n */\n function distribute(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return approveSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Approves a subscription to an index with user data. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function approveSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Revokes a previously approved subscription.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId\n ) internal returns (bool) {\n return revokeSubscription(token, publisher, indexId, new bytes(0));\n }\n\n /**\n * @dev Revokes a previously approved subscription. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param userData Arbitrary user data field.\n */\n function revokeSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber holds\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units\n ) internal returns (bool) {\n return updateSubscriptionUnits(token, indexId, subscriber, units, new bytes(0));\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param userData Arbitrary user data field.\n */\n function updateSubscriptionUnits(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return deleteSubscription(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param userData Arbitrary user data field.\n */\n function deleteSubscription(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber\n ) internal returns (bool) {\n return claim(token, publisher, indexId, subscriber, new bytes(0));\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param userData Arbitrary user data field.\n */\n function claim(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory userData\n ) internal returns (bool) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n host.callAgreement(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n userData\n );\n return true;\n }\n\n /** IDA WITH CTX FUNCTIONS ************************************* */\n\n /**\n * @dev Creates a new index with ctx.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function createIndexWithCtx(\n ISuperToken token,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.createIndex,\n (\n token,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates an index value with ctx. This distributes an amount of tokens equal to\n * `indexValue - lastIndexValue`. See `distribute` for another way to distribute.\n * Meant for usage in super app callbakcs\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param indexValue New TOTAL index value, this will equal the total amount distributed.\n * @param ctx from super app callback\n */\n function updateIndexValueWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateIndex,\n (\n token,\n indexId,\n indexValue,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Distributes tokens in a more developer friendly way than `updateIndex`.Instead of\n * passing the new total index value, this function will increase the index value by `amount`.\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param amount Amount by which the index value should increase.\n * @param ctx from super app callback\n */\n function distributeWithCtx(\n ISuperToken token,\n uint32 indexId,\n uint256 amount,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.distribute,\n (\n token,\n indexId,\n amount,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Approves a subscription to an index. The subscriber's real time balance will not update\n * until the subscription is approved, but once approved, the balance will be updated with\n * prior distributions.\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function approveSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.approveSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Revokes a previously approved subscription. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param ctx from super app callback\n */\n function revokeSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.revokeSubscription,\n (\n token,\n publisher,\n indexId,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Updates the units of a subscription. This changes the number of shares the subscriber\n * holds. Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be updated.\n * @param units New number of units the subscriber holds.\n * @param ctx from super app callback\n */\n function updateSubscriptionUnitsWithCtx(\n ISuperToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.updateSubscription,\n (\n token,\n indexId,\n subscriber,\n units,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Deletes a subscription, setting a subcriber's units to zero.\n * Meant for usage in super apps\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address whose units are to be deleted.\n * @param ctx from super app callback\n */\n function deleteSubscriptionWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.deleteSubscription,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n /**\n * @dev Claims pending distribution. Subscription should not be approved.\n * Meant for usage in super app callbacks\n * @param token Super Token used with the index.\n * @param publisher Publisher of the index.\n * @param indexId ID of the index.\n * @param subscriber Subscriber address that receives the claim.\n * @param ctx from super app callback\n */\n function claimWithCtx(\n ISuperToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes memory ctx\n ) internal returns (bytes memory newCtx) {\n (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);\n (newCtx, ) = host.callAgreementWithContext(\n ida,\n abi.encodeCall(\n ida.claim,\n (\n token,\n publisher,\n indexId,\n subscriber,\n new bytes(0) // ctx placeholder\n )\n ),\n \"0x\",\n ctx\n );\n }\n\n // ************** private helpers **************\n\n // @note We must use hardcoded constants here because:\n // Only direct number constants and references to such constants are supported by inline assembly.\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.host\")\n bytes32 private constant _HOST_SLOT = 0x65599bf746e17a00ea62e3610586992d88101b78eec3cf380706621fb97ea837;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.cfa\")\n bytes32 private constant _CFA_SLOT = 0xb969d79d88acd02d04ed7ee7d43b949e7daf093d363abcfbbc43dfdfd1ce969a;\n // keccak256(\"org.superfluid-finance.apps.SuperTokenLibrary.v1.ida\");\n bytes32 private constant _IDA_SLOT = 0xa832ee1924ea960211af2df07d65d166232018f613ac6708043cd8f8773eddeb;\n\n // gets the host and cfa addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndCFA(ISuperToken token) private\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_CFA_SLOT, cfa)\n }\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token and caches it in storage for gas efficiency\n // to be used in state changing methods\n function _getAndCacheHostAndIDA(ISuperToken token) private\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n // now that we got them and are in a transaction context, persist in storage\n assembly {\n // solium-disable-line\n sstore(_HOST_SLOT, host)\n sstore(_IDA_SLOT, ida)\n }\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n\n // gets the host and cfa addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndCFA(ISuperToken token) private view\n returns(ISuperfluid host, IConstantFlowAgreementV1 cfa)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n cfa := sload(_CFA_SLOT)\n }\n if (address(cfa) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n cfa = IConstantFlowAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(cfa) != address(0));\n }\n\n // gets the host and ida addrs for the token\n // to be used in non-state changing methods (view functions)\n function _getHostAndIDA(ISuperToken token) private view\n returns(ISuperfluid host, IInstantDistributionAgreementV1 ida)\n {\n // check if already in contract storage...\n assembly { // solium-disable-line\n host := sload(_HOST_SLOT)\n ida := sload(_IDA_SLOT)\n }\n if (address(ida) == address(0)) {\n // framework contract addrs not yet cached in storage, retrieving now...\n if (address(host) == address(0)) {\n host = ISuperfluid(token.getHost());\n }\n ida = IInstantDistributionAgreementV1(address(ISuperfluid(host).getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\"))));\n }\n assert(address(host) != address(0));\n assert(address(ida) != address(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n/**\n * @title Constant Flow Agreement interface\n * @author Superfluid\n */\nabstract contract IConstantFlowAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error CFA_ACL_NO_SENDER_CREATE(); // 0x4b993136\n error CFA_ACL_NO_SENDER_UPDATE(); // 0xedfa0d3b\n error CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS(); // 0xa3eab6ac\n error CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS(); // 0xac434b5f\n error CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS(); // 0xe30f1bff\n error CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED(); // 0xa0645c1f\n error CFA_ACL_UNCLEAN_PERMISSIONS(); // 0x7939d66c\n error CFA_ACL_NO_SENDER_FLOW_OPERATOR(); // 0xb0ed394d\n error CFA_ACL_NO_NEGATIVE_ALLOWANCE(); // 0x86e0377d\n error CFA_FLOW_ALREADY_EXISTS(); // 0x801b6863\n error CFA_FLOW_DOES_NOT_EXIST(); // 0x5a32bf24\n error CFA_INSUFFICIENT_BALANCE(); // 0xea76c9b3\n error CFA_ZERO_ADDRESS_SENDER(); // 0x1ce9b067\n error CFA_ZERO_ADDRESS_RECEIVER(); // 0x78e02b2a\n error CFA_HOOK_OUT_OF_GAS(); // 0x9f76430b\n error CFA_DEPOSIT_TOO_BIG(); // 0x752c2b9c\n error CFA_FLOW_RATE_TOO_BIG(); // 0x0c9c55c1\n error CFA_NON_CRITICAL_SENDER(); // 0xce11b5d1\n error CFA_INVALID_FLOW_RATE(); // 0x91acad16\n error CFA_NO_SELF_FLOW(); // 0xa47338ef\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\");\n }\n\n /**\n * @notice Get the maximum flow rate allowed with the deposit\n * @dev The deposit is clipped and rounded down\n * @param deposit Deposit amount used for creating the flow\n * @return flowRate The maximum flow rate\n */\n function getMaximumFlowRateFromDeposit(\n ISuperfluidToken token,\n uint256 deposit)\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Get the deposit required for creating the flow\n * @dev Calculates the deposit based on the liquidationPeriod and flowRate\n * @param flowRate Flow rate to be tested\n * @return deposit The deposit amount based on flowRate and liquidationPeriod\n * @custom:note \n * - if calculated deposit (flowRate * liquidationPeriod) is less\n * than the minimum deposit, we use the minimum deposit otherwise\n * we use the calculated deposit\n */\n function getDepositRequiredForFlowRate(\n ISuperfluidToken token,\n int96 flowRate)\n external view virtual\n returns (uint256 deposit);\n\n /**\n * @dev Returns whether it is the patrician period based on host.getNow()\n * @param account The account we are interested in\n * @return isCurrentlyPatricianPeriod Whether it is currently the patrician period dictated by governance\n * @return timestamp The value of host.getNow()\n */\n function isPatricianPeriodNow(\n ISuperfluidToken token,\n address account)\n external view virtual\n returns (bool isCurrentlyPatricianPeriod, uint256 timestamp);\n\n /**\n * @dev Returns whether it is the patrician period based on timestamp\n * @param account The account we are interested in\n * @param timestamp The timestamp we are interested in observing the result of isPatricianPeriod\n * @return bool Whether it is currently the patrician period dictated by governance\n */\n function isPatricianPeriod(\n ISuperfluidToken token,\n address account,\n uint256 timestamp\n )\n public view virtual\n returns (bool);\n\n /**\n * @dev msgSender from `ctx` updates permissions for the `flowOperator` with `flowRateAllowance`\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param permissions A bitmask representation of the granted permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowOperatorPermissions(\n ISuperfluidToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowRateAllowance,\n bytes calldata ctx\n ) \n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` increases flow rate allowance for the `flowOperator` by `addedFlowRateAllowance`\n * @dev if `addedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param addedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function increaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 addedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` decreases flow rate allowance for the `flowOperator` by `subtractedFlowRateAllowance`\n * @dev if `subtractedFlowRateAllowance` is negative, we revert with CFA_ACL_NO_NEGATIVE_ALLOWANCE\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param subtractedFlowRateAllowance The flow rate allowance delta\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @return newCtx The new context bytes\n */\n function decreaseFlowRateAllowance(\n ISuperfluidToken token,\n address flowOperator,\n int96 subtractedFlowRateAllowance,\n bytes calldata ctx\n ) external virtual returns(bytes memory newCtx);\n\n /**\n * @dev msgSender from `ctx` grants `flowOperator` all permissions with flowRateAllowance as type(int96).max\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function authorizeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice msgSender from `ctx` revokes `flowOperator` create/update/delete permissions\n * @dev `permissions` and `flowRateAllowance` will both be set to 0\n * @param token Super token address\n * @param flowOperator The permission grantee address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function revokeFlowOperatorWithFullControl(\n ISuperfluidToken token,\n address flowOperator,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Get the permissions of a flow operator between `sender` and `flowOperator` for `token`\n * @param token Super token address\n * @param sender The permission granter address\n * @param flowOperator The permission grantee address\n * @return flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorData(\n ISuperfluidToken token,\n address sender,\n address flowOperator\n )\n public view virtual\n returns (\n bytes32 flowOperatorId,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Get flow operator using flowOperatorId\n * @param token Super token address\n * @param flowOperatorId The keccak256 hash of encoded string \"flowOperator\", sender and flowOperator\n * @return permissions A bitmask representation of the granted permissions\n * @return flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n function getFlowOperatorDataByID(\n ISuperfluidToken token,\n bytes32 flowOperatorId\n )\n external view virtual\n returns (\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @notice Create a flow betwen ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementCreated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - A deposit is taken as safety margin for the solvency agents\n * - A extra gas fee may be taken to pay for solvency agent liquidations\n */\n function createFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Create a flow between sender and receiver\n * @dev A flow created by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function createFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update the flow rate between ctx.msgSender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Only the flow sender may update the flow rate\n * - Even if the flow rate is zero, the flow is not deleted\n * from the system\n * - Deposit amount will be adjusted accordingly\n * - No new gas fee is charged\n */\n function updateFlow(\n ISuperfluidToken token,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Update a flow between sender and receiver\n * @dev A flow updated by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param sender Flow sender address (has granted permissions)\n * @param receiver Flow receiver address\n * @param flowRate New flow rate in amount per second\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n */\n function updateFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n int96 flowRate,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Get the flow data between `sender` and `receiver` of `token`\n * @param token Super token address\n * @param sender Flow receiver\n * @param receiver Flow sender\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The amount of deposit the flow\n * @return owedDeposit The amount of owed deposit of the flow\n */\n function getFlow(\n ISuperfluidToken token,\n address sender,\n address receiver\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @notice Get flow data using agreementId\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return timestamp Timestamp of when the flow is updated\n * @return flowRate The flow rate\n * @return deposit The deposit amount of the flow\n * @return owedDeposit The owed deposit amount of the flow\n */\n function getFlowByID(\n ISuperfluidToken token,\n bytes32 agreementId\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n /**\n * @dev Get the aggregated flow info of the account\n * @param token Super token address\n * @param account Account for the query\n * @return timestamp Timestamp of when a flow was last updated for account\n * @return flowRate The net flow rate of token for account\n * @return deposit The sum of all deposits for account's flows\n * @return owedDeposit The sum of all owed deposits for account's flows\n */\n function getAccountFlowInfo(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (\n uint256 timestamp,\n int96 flowRate,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @dev Get the net flow rate of the account\n * @param token Super token address\n * @param account Account for the query\n * @return flowRate Net flow rate\n */\n function getNetFlow(\n ISuperfluidToken token,\n address account\n )\n external view virtual\n returns (int96 flowRate);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev flowId (agreementId) is the keccak256 hash of encoded sender and receiver\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n *\n * @custom:callbacks \n * - AgreementTerminated\n * - agreementId - can be used in getFlowByID\n * - agreementData - abi.encode(address flowSender, address flowReceiver)\n *\n * @custom:note \n * - Both flow sender and receiver may delete the flow\n * - If Sender account is insolvent or in critical state, a solvency agent may\n * also terminate the agreement\n * - Gas fee may be returned to the sender\n */\n function deleteFlow(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n\n /**\n * @notice Delete the flow between sender and receiver\n * @dev A flow deleted by an approved flow operator (see above for details on callbacks)\n * @param token Super token address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n * @param receiver Flow receiver address\n */\n function deleteFlowByOperator(\n ISuperfluidToken token,\n address sender,\n address receiver,\n bytes calldata ctx\n )\n external virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Flow operator updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param flowOperator Flow operator address\n * @param permissions Octo bitmask representation of permissions\n * @param flowRateAllowance The flow rate allowance the `flowOperator` is granted (only goes down)\n */\n event FlowOperatorUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed flowOperator,\n uint8 permissions,\n int96 flowRateAllowance\n );\n\n /**\n * @dev Flow updated event\n * @param token Super token address\n * @param sender Flow sender address\n * @param receiver Flow recipient address\n * @param flowRate Flow rate in amount per second for this flow\n * @param totalSenderFlowRate Total flow rate in amount per second for the sender\n * @param totalReceiverFlowRate Total flow rate in amount per second for the receiver\n * @param userData The user provided data\n *\n */\n event FlowUpdated(\n ISuperfluidToken indexed token,\n address indexed sender,\n address indexed receiver,\n int96 flowRate,\n int256 totalSenderFlowRate,\n int256 totalReceiverFlowRate,\n bytes userData\n );\n\n /**\n * @dev Flow updated extension event\n * @param flowOperator Flow operator address - the Context.msgSender\n * @param deposit The deposit amount for the stream\n */\n event FlowUpdatedExtension(\n address indexed flowOperator,\n uint256 deposit\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"../superfluid/ISuperAgreement.sol\";\nimport { ISuperfluidToken } from \"../superfluid/ISuperfluidToken.sol\";\n\n\n/**\n * @title Instant Distribution Agreement interface\n * @author Superfluid\n *\n * @notice \n * - A publisher can create as many as indices as possibly identifiable with `indexId`.\n * - `indexId` is deliberately limited to 32 bits, to avoid the chance for sha-3 collision.\n * Despite knowing sha-3 collision is only theoretical.\n * - A publisher can create a subscription to an index for any subscriber.\n * - A subscription consists of:\n * - The index it subscribes to.\n * - Number of units subscribed.\n * - An index consists of:\n * - Current value as `uint128 indexValue`.\n * - Total units of the approved subscriptions as `uint128 totalUnitsApproved`.\n * - Total units of the non approved subscription as `uint128 totalUnitsPending`.\n * - A publisher can update an index with a new value that doesn't decrease.\n * - A publisher can update a subscription with any number of units.\n * - A publisher or a subscriber can delete a subscription and reset its units to zero.\n * - A subscriber must approve the index in order to receive distributions from the publisher\n * each time the index is updated.\n * - The amount distributed is $$\\Delta{index} * units$$\n * - Distributions to a non approved subscription stays in the publisher's deposit until:\n * - the subscriber approves the subscription (side effect),\n * - the publisher updates the subscription (side effect),\n * - the subscriber deletes the subscription even if it is never approved (side effect),\n * - or the subscriber can explicitly claim them.\n */\nabstract contract IInstantDistributionAgreementV1 is ISuperAgreement {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error IDA_INDEX_SHOULD_GROW(); // 0xcfdca725\n error IDA_OPERATION_NOT_ALLOWED(); // 0x92da6d17\n error IDA_INDEX_ALREADY_EXISTS(); // 0x5c02a517\n error IDA_INDEX_DOES_NOT_EXIST(); // 0xedeaa63b\n error IDA_SUBSCRIPTION_DOES_NOT_EXIST(); // 0xb6c8c980\n error IDA_SUBSCRIPTION_ALREADY_APPROVED(); // 0x3eb2f849\n error IDA_SUBSCRIPTION_IS_NOT_APPROVED(); // 0x37412573\n error IDA_INSUFFICIENT_BALANCE(); // 0x16e759bb\n error IDA_ZERO_ADDRESS_SUBSCRIBER(); // 0xc90a4674\n\n /// @dev ISuperAgreement.agreementType implementation\n function agreementType() external override pure returns (bytes32) {\n return keccak256(\"org.superfluid-finance.agreements.InstantDistributionAgreement.v1\");\n }\n\n /**************************************************************************\n * Index operations\n *************************************************************************/\n\n /**\n * @dev Create a new index for the publisher\n * @param token Super token address\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function createIndex(\n ISuperfluidToken token,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index created event\n * @param token Super token address\n * @param publisher Index creator and publisher\n * @param indexId The specified indexId of the newly created index\n * @param userData The user provided data\n */\n event IndexCreated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n bytes userData);\n\n /**\n * @dev Query the data of a index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @return exist Does the index exist\n * @return indexValue Value of the current index\n * @return totalUnitsApproved Total units approved for the index\n * @return totalUnitsPending Total units pending approval for the index\n */\n function getIndex(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId)\n external\n view\n virtual\n returns(\n bool exist,\n uint128 indexValue,\n uint128 totalUnitsApproved,\n uint128 totalUnitsPending);\n\n /**\n * @dev Calculate actual distribution amount\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @return actualAmount The amount to be distributed after ensuring no rounding errors\n * @return newIndexValue The index value given the desired amount of tokens to be distributed\n */\n function calculateDistribution(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n uint256 amount)\n external view\n virtual\n returns(\n uint256 actualAmount,\n uint128 newIndexValue);\n\n /**\n * @dev Update index value of an index\n * @param token Super token address\n * @param indexId Id of the index\n * @param indexValue Value of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * None\n */\n function updateIndex(\n ISuperfluidToken token,\n uint32 indexId,\n uint128 indexValue,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index updated event\n * @param token Super token address\n * @param publisher Index updater and publisher\n * @param indexId The specified indexId of the updated index\n * @param oldIndexValue The previous index value\n * @param newIndexValue The updated index value\n * @param totalUnitsPending The total units pending when the indexValue was updated\n * @param totalUnitsApproved The total units approved when the indexValue was updated\n * @param userData The user provided data\n */\n event IndexUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n uint128 oldIndexValue,\n uint128 newIndexValue,\n uint128 totalUnitsPending,\n uint128 totalUnitsApproved,\n bytes userData);\n\n /**\n * @dev Distribute tokens through the index\n * @param token Super token address\n * @param indexId Id of the index\n * @param amount The amount of tokens desired to be distributed\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note \n * - This is a convenient version of updateIndex. It adds to the index\n * a delta that equals to `amount / totalUnits`\n * - The actual amount distributed could be obtained via\n * `calculateDistribution`. This is due to precision error with index\n * value and units data range\n *\n * @custom:callbacks \n * None\n */\n function distribute(\n ISuperfluidToken token,\n uint32 indexId,\n uint256 amount,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n\n /**************************************************************************\n * Subscription operations\n *************************************************************************/\n\n /**\n * @dev Approve the subscription of an index\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the publisher:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function approveSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index subscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The approved subscriber\n * @param userData The user provided data\n */\n event IndexSubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n\n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionApproved(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @notice Revoke the subscription of an index\n * @dev \"Unapproves\" the subscription and moves approved units to pending\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function revokeSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n /**\n * @dev Index unsubscribed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The unsubscribed subscriber\n * @param userData The user provided data\n */\n event IndexUnsubscribed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n bytes userData);\n \n /**\n * @dev Subscription approved event\n * @param token Super token address\n * @param subscriber The approved subscriber\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param userData The user provided data\n */\n event SubscriptionRevoked(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n bytes userData);\n\n /**\n * @dev Update the nuber of units of a subscription\n * @param token Super token address\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @param units Number of units of the subscription\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if subscription exist\n * - AgreementCreated callback to the subscriber:\n * - agreementId is for the subscription\n * - if subscription does not exist\n * - AgreementUpdated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function updateSubscription(\n ISuperfluidToken token,\n uint32 indexId,\n address subscriber,\n uint128 units,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Index units updated event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param units The new units amount\n * @param userData The user provided data\n */\n event IndexUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint128 units,\n bytes userData);\n \n /**\n * @dev Subscription units updated event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param indexId The specified indexId\n * @param publisher Index publisher\n * @param units The new units amount\n * @param userData The user provided data\n */\n event SubscriptionUnitsUpdated(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint128 units,\n bytes userData);\n\n /**\n * @dev Get data of a subscription\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber of the index\n * @return exist Does the subscription exist?\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber)\n external\n view\n virtual\n returns(\n bool exist,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @notice Get data of a subscription by agreement ID\n * @dev indexId (agreementId) is the keccak256 hash of encodePacked(\"publisher\", publisher, indexId)\n * @param token Super token address\n * @param agreementId The agreement ID\n * @return publisher The publisher of the index\n * @return indexId Id of the index\n * @return approved Is the subscription approved?\n * @return units Units of the suscription\n * @return pendingDistribution Pending amount of tokens to be distributed for unapproved subscription\n */\n function getSubscriptionByID(\n ISuperfluidToken token,\n bytes32 agreementId)\n external\n view\n virtual\n returns(\n address publisher,\n uint32 indexId,\n bool approved,\n uint128 units,\n uint256 pendingDistribution\n );\n\n /**\n * @dev List subscriptions of an user\n * @param token Super token address\n * @param subscriber The subscriber's address\n * @return publishers Publishers of the subcriptions\n * @return indexIds Indexes of the subscriptions\n * @return unitsList Units of the subscriptions\n */\n function listSubscriptions(\n ISuperfluidToken token,\n address subscriber)\n external\n view\n virtual\n returns(\n address[] memory publishers,\n uint32[] memory indexIds,\n uint128[] memory unitsList);\n\n /**\n * @dev Delete the subscription of an user\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:callbacks \n * - if the subscriber called it\n * - AgreementTerminated callback to the publsiher:\n * - agreementId is for the subscription\n * - if the publisher called it\n * - AgreementTerminated callback to the subscriber:\n * - agreementId is for the subscription\n */\n function deleteSubscription(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n\n /**\n * @dev Claim pending distributions\n * @param token Super token address\n * @param publisher The publisher of the index\n * @param indexId Id of the index\n * @param subscriber The subscriber's address\n * @param ctx Context bytes (see ISuperfluid.sol for Context struct)\n *\n * @custom:note The subscription should not be approved yet\n *\n * @custom:callbacks \n * - AgreementUpdated callback to the publisher:\n * - agreementId is for the subscription\n */\n function claim(\n ISuperfluidToken token,\n address publisher,\n uint32 indexId,\n address subscriber,\n bytes calldata ctx)\n external\n virtual\n returns(bytes memory newCtx);\n \n /**\n * @dev Index distribution claimed event\n * @param token Super token address\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param subscriber The subscriber units updated\n * @param amount The pending amount claimed\n */\n event IndexDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed publisher,\n uint32 indexed indexId,\n address subscriber,\n uint256 amount);\n \n /**\n * @dev Subscription distribution claimed event\n * @param token Super token address\n * @param subscriber The subscriber units updated\n * @param publisher Index publisher\n * @param indexId The specified indexId\n * @param amount The pending amount claimed\n */\n event SubscriptionDistributionClaimed(\n ISuperfluidToken indexed token,\n address indexed subscriber,\n address publisher,\n uint32 indexId,\n uint256 amount);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title Super app definitions library\n * @author Superfluid\n */\nlibrary SuperAppDefinitions {\n\n /**************************************************************************\n / App manifest config word\n /**************************************************************************/\n\n /*\n * App level is a way to allow the app to whitelist what other app it can\n * interact with (aka. composite app feature).\n *\n * For more details, refer to the technical paper of superfluid protocol.\n */\n uint256 constant internal APP_LEVEL_MASK = 0xFF;\n\n // The app is at the final level, hence it doesn't want to interact with any other app\n uint256 constant internal APP_LEVEL_FINAL = 1 << 0;\n\n // The app is at the second level, it may interact with other final level apps if whitelisted\n uint256 constant internal APP_LEVEL_SECOND = 1 << 1;\n\n function getAppCallbackLevel(uint256 configWord) internal pure returns (uint8) {\n return uint8(configWord & APP_LEVEL_MASK);\n }\n\n uint256 constant internal APP_JAIL_BIT = 1 << 15;\n function isAppJailed(uint256 configWord) internal pure returns (bool) {\n return (configWord & SuperAppDefinitions.APP_JAIL_BIT) > 0;\n }\n\n /**************************************************************************\n / Callback implementation bit masks\n /**************************************************************************/\n uint256 constant internal AGREEMENT_CALLBACK_NOOP_BITMASKS = 0xFF << 32;\n uint256 constant internal BEFORE_AGREEMENT_CREATED_NOOP = 1 << (32 + 0);\n uint256 constant internal AFTER_AGREEMENT_CREATED_NOOP = 1 << (32 + 1);\n uint256 constant internal BEFORE_AGREEMENT_UPDATED_NOOP = 1 << (32 + 2);\n uint256 constant internal AFTER_AGREEMENT_UPDATED_NOOP = 1 << (32 + 3);\n uint256 constant internal BEFORE_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 4);\n uint256 constant internal AFTER_AGREEMENT_TERMINATED_NOOP = 1 << (32 + 5);\n\n /**************************************************************************\n / App Jail Reasons\n /**************************************************************************/\n\n uint256 constant internal APP_RULE_REGISTRATION_ONLY_IN_CONSTRUCTOR = 1;\n uint256 constant internal APP_RULE_NO_REGISTRATION_FOR_EOA = 2;\n uint256 constant internal APP_RULE_NO_REVERT_ON_TERMINATION_CALLBACK = 10;\n uint256 constant internal APP_RULE_NO_CRITICAL_SENDER_ACCOUNT = 11;\n uint256 constant internal APP_RULE_NO_CRITICAL_RECEIVER_ACCOUNT = 12;\n uint256 constant internal APP_RULE_CTX_IS_READONLY = 20;\n uint256 constant internal APP_RULE_CTX_IS_NOT_CLEAN = 21;\n uint256 constant internal APP_RULE_CTX_IS_MALFORMATED = 22;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED = 30;\n uint256 constant internal APP_RULE_COMPOSITE_APP_IS_JAILED = 31;\n uint256 constant internal APP_RULE_MAX_APP_LEVEL_REACHED = 40;\n\n // Validate configWord cleaness for future compatibility, or else may introduce undefined future behavior\n function isConfigWordClean(uint256 configWord) internal pure returns (bool) {\n return (configWord & ~(APP_LEVEL_MASK | APP_JAIL_BIT | AGREEMENT_CALLBACK_NOOP_BITMASKS)) == uint256(0);\n }\n}\n\n/**\n * @title Context definitions library\n * @author Superfluid\n */\nlibrary ContextDefinitions {\n\n /**************************************************************************\n / Call info\n /**************************************************************************/\n\n // app level\n uint256 constant internal CALL_INFO_APP_LEVEL_MASK = 0xFF;\n\n // call type\n uint256 constant internal CALL_INFO_CALL_TYPE_SHIFT = 32;\n uint256 constant internal CALL_INFO_CALL_TYPE_MASK = 0xF << CALL_INFO_CALL_TYPE_SHIFT;\n uint8 constant internal CALL_INFO_CALL_TYPE_AGREEMENT = 1;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_ACTION = 2;\n uint8 constant internal CALL_INFO_CALL_TYPE_APP_CALLBACK = 3;\n\n function decodeCallInfo(uint256 callInfo)\n internal pure\n returns (uint8 appCallbackLevel, uint8 callType)\n {\n appCallbackLevel = uint8(callInfo & CALL_INFO_APP_LEVEL_MASK);\n callType = uint8((callInfo & CALL_INFO_CALL_TYPE_MASK) >> CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n function encodeCallInfo(uint8 appCallbackLevel, uint8 callType)\n internal pure\n returns (uint256 callInfo)\n {\n return uint256(appCallbackLevel) | (uint256(callType) << CALL_INFO_CALL_TYPE_SHIFT);\n }\n\n}\n\n/**\n * @title Flow Operator definitions library\n * @author Superfluid\n */\n library FlowOperatorDefinitions {\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_CREATE = uint8(1) << 0;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_UPDATE = uint8(1) << 1;\n uint8 constant internal AUTHORIZE_FLOW_OPERATOR_DELETE = uint8(1) << 2;\n uint8 constant internal AUTHORIZE_FULL_CONTROL =\n AUTHORIZE_FLOW_OPERATOR_CREATE | AUTHORIZE_FLOW_OPERATOR_UPDATE | AUTHORIZE_FLOW_OPERATOR_DELETE;\n uint8 constant internal REVOKE_FLOW_OPERATOR_CREATE = ~(uint8(1) << 0);\n uint8 constant internal REVOKE_FLOW_OPERATOR_UPDATE = ~(uint8(1) << 1);\n uint8 constant internal REVOKE_FLOW_OPERATOR_DELETE = ~(uint8(1) << 2);\n\n function isPermissionsClean(uint8 permissions) internal pure returns (bool) {\n return (\n permissions & ~(AUTHORIZE_FLOW_OPERATOR_CREATE\n | AUTHORIZE_FLOW_OPERATOR_UPDATE\n | AUTHORIZE_FLOW_OPERATOR_DELETE)\n ) == uint8(0);\n }\n }\n\n/**\n * @title Batch operation library\n * @author Superfluid\n */\nlibrary BatchOperation {\n /**\n * @dev ERC20.approve batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationApprove(\n * abi.decode(data, (address spender, uint256 amount))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_APPROVE = 1;\n /**\n * @dev ERC20.transferFrom batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationTransferFrom(\n * abi.decode(data, (address sender, address recipient, uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_TRANSFER_FROM = 2;\n /**\n * @dev ERC777.send batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationSend(\n * abi.decode(data, (address recipient, uint256 amount, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC777_SEND = 3;\n /**\n * @dev ERC20.increaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationIncreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 addedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_INCREASE_ALLOWANCE = 4;\n /**\n * @dev ERC20.decreaseAllowance batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDecreaseAllowance(\n * abi.decode(data, (address account, address spender, uint256 subtractedValue))\n * )\n */\n uint32 constant internal OPERATION_TYPE_ERC20_DECREASE_ALLOWANCE = 5;\n /**\n * @dev SuperToken.upgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationUpgrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_UPGRADE = 1 + 100;\n /**\n * @dev SuperToken.downgrade batch operation type\n *\n * Call spec:\n * ISuperToken(target).operationDowngrade(\n * abi.decode(data, (uint256 amount)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERTOKEN_DOWNGRADE = 2 + 100;\n /**\n * @dev Superfluid.callAgreement batch operation type\n *\n * Call spec:\n * callAgreement(\n * ISuperAgreement(target)),\n * abi.decode(data, (bytes callData, bytes userData)\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT = 1 + 200;\n /**\n * @dev Superfluid.callAppAction batch operation type\n *\n * Call spec:\n * callAppAction(\n * ISuperApp(target)),\n * data\n * )\n */\n uint32 constant internal OPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION = 2 + 200;\n}\n\n/**\n * @title Superfluid governance configs library\n * @author Superfluid\n */\nlibrary SuperfluidGovernanceConfigs {\n\n bytes32 constant internal SUPERFLUID_REWARD_ADDRESS_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.superfluid.rewardAddress\");\n bytes32 constant internal CFAV1_PPP_CONFIG_KEY =\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration\");\n bytes32 constant internal SUPERTOKEN_MINIMUM_DEPOSIT_KEY =\n keccak256(\"org.superfluid-finance.superfluid.superTokenMinimumDeposit\");\n\n function getTrustedForwarderConfigKey(address forwarder) internal pure returns (bytes32) {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.trustedForwarder\",\n forwarder));\n }\n\n function getAppRegistrationConfigKey(address deployer, string memory registrationKey) internal pure\n returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.registrationKey\",\n deployer,\n registrationKey));\n }\n\n function getAppFactoryConfigKey(address factory) internal pure returns (bytes32)\n {\n return keccak256(abi.encode(\n \"org.superfluid-finance.superfluid.appWhiteListing.factory\",\n factory));\n }\n\n function decodePPPConfig(uint256 pppConfig) internal pure\n returns (uint256 liquidationPeriod, uint256 patricianPeriod)\n {\n liquidationPeriod = (pppConfig >> 32) & type(uint32).max;\n patricianPeriod = pppConfig & type(uint32).max;\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantInflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantInflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n error CIF_NFT_ONLY_CONSTANT_OUTFLOW(); // 0xe81ef57a\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The mint function emits the \"mint\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param to the flow receiver (inflow NFT receiver)\n /// @param newTokenId the new token id\n function mint(address to, uint256 newTokenId) external;\n\n /// @notice This burn function emits the \"burn\" `Transfer` event.\n /// @dev We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose\n /// is to inform clients that search for events.\n /// @param tokenId desired token id to burn\n function burn(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IConstantOutflowNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { IFlowNFTBase } from \"./IFlowNFTBase.sol\";\n\ninterface IConstantOutflowNFT is IFlowNFTBase {\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error COF_NFT_INVALID_SUPER_TOKEN(); // 0x6de98774\n error COF_NFT_MINT_TO_AND_FLOW_RECEIVER_SAME(); // 0x0d1d1161\n error COF_NFT_MINT_TO_ZERO_ADDRESS(); // 0x43d05e51\n error COF_NFT_ONLY_CONSTANT_INFLOW(); // 0xa495a718\n error COF_NFT_ONLY_FLOW_AGREEMENTS(); // 0xd367b64f\n error COF_NFT_TOKEN_ALREADY_EXISTS(); // 0xe2480183\n\n\n /**************************************************************************\n * Write Functions\n *************************************************************************/\n\n /// @notice The onCreate function is called when a new flow is created.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onCreate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onUpdate function is called when a flow is updated.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onUpdate(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n\n /// @notice The onDelete function is called when a flow is deleted.\n /// @param token the super token passed from the CFA (flowVars)\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n function onDelete(ISuperfluidToken token, address flowSender, address flowReceiver) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IFlowNFTBase.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {\n IERC721Metadata\n} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\ninterface IFlowNFTBase is IERC721Metadata {\n // FlowNFTData struct storage packing:\n // b = bits\n // WORD 1: | superToken | FREE\n // | 160b | 96b\n // WORD 2: | flowSender | FREE\n // | 160b | 96b\n // WORD 3: | flowReceiver | flowStartDate | FREE\n // | 160b | 32b | 64b\n struct FlowNFTData {\n address superToken;\n address flowSender;\n address flowReceiver;\n uint32 flowStartDate;\n }\n\n /**************************************************************************\n * Custom Errors\n *************************************************************************/\n\n error CFA_NFT_APPROVE_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0xa3352582\n error CFA_NFT_APPROVE_TO_CALLER(); // 0xd3c77329\n error CFA_NFT_APPROVE_TO_CURRENT_OWNER(); // 0xe4790b25\n error CFA_NFT_INVALID_TOKEN_ID(); // 0xeab95e3b\n error CFA_NFT_ONLY_SUPER_TOKEN_FACTORY(); // 0xebb7505b\n error CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); // 0x2551d606\n error CFA_NFT_TRANSFER_FROM_INCORRECT_OWNER(); // 0x5a26c744\n error CFA_NFT_TRANSFER_IS_NOT_ALLOWED(); // 0xaa747eca\n error CFA_NFT_TRANSFER_TO_ZERO_ADDRESS(); // 0xde06d21e\n\n /**************************************************************************\n * Events\n *************************************************************************/\n\n /// @notice Informs third-party platforms that NFT metadata should be updated\n /// @dev This event comes from https://eips.ethereum.org/EIPS/eip-4906\n /// @param tokenId the id of the token that should have its metadata updated\n event MetadataUpdate(uint256 tokenId);\n\n /**************************************************************************\n * View\n *************************************************************************/\n\n /// @notice An external function for querying flow data by `tokenId``\n /// @param tokenId the token id\n /// @return flowData the flow data associated with `tokenId`\n function flowDataByTokenId(\n uint256 tokenId\n ) external view returns (FlowNFTData memory flowData);\n\n /// @notice An external function for computing the deterministic tokenId\n /// @dev tokenId = uint256(keccak256(abi.encode(block.chainId, superToken, flowSender, flowReceiver)))\n /// @param superToken the super token\n /// @param flowSender the flow sender\n /// @param flowReceiver the flow receiver\n /// @return tokenId the tokenId\n function getTokenId(\n address superToken,\n address flowSender,\n address flowReceiver\n ) external view returns (uint256);\n\n /**************************************************************************\n * Write\n *************************************************************************/\n\n function initialize(\n string memory nftName,\n string memory nftSymbol\n ) external; // initializer;\n\n function triggerMetadataUpdate(uint256 tokenId) external;\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolAdminNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolAdminNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/IPoolMemberNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPoolMemberNFT {}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\n\n/**\n * @title Super agreement interface\n * @author Superfluid\n */\ninterface ISuperAgreement {\n\n /**\n * @dev Get the type of the agreement class\n */\n function agreementType() external view returns (bytes32);\n\n /**\n * @dev Calculate the real-time balance for the account of this agreement class\n * @param account Account the state belongs to\n * @param time Time used for the calculation\n * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement\n * @return deposit Account deposit amount of this agreement\n * @return owedDeposit Account owed deposit amount of this agreement\n */\n function realtimeBalanceOf(\n ISuperfluidToken token,\n address account,\n uint256 time\n )\n external\n view\n returns (\n int256 dynamicBalance,\n uint256 deposit,\n uint256 owedDeposit\n );\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\n/**\n * @title SuperApp interface\n * @author Superfluid\n * @dev Be aware of the app being jailed, when the word permitted is used.\n */\ninterface ISuperApp {\n\n /**\n * @dev Callback before a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is created.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementCreated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass\n * arbitary information to the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function beforeAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n\n /**\n * @dev Callback after a new agreement is updated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Only revert with a \"reason\" is permitted.\n */\n function afterAgreementUpdated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n\n /**\n * @dev Callback before a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param ctx The context data.\n * @return cbdata A free format in memory data the app can use to pass arbitary information to\n * the after-hook callback.\n *\n * @custom:note \n * - It will be invoked with `staticcall`, no state changes are permitted.\n * - Revert is not permitted.\n */\n function beforeAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata ctx\n )\n external\n view\n returns (bytes memory cbdata);\n\n /**\n * @dev Callback after a new agreement is terminated.\n * @param superToken The super token used for the agreement.\n * @param agreementClass The agreement class address.\n * @param agreementId The agreementId\n * @param agreementData The agreement data (non-compressed)\n * @param cbdata The data returned from the before-hook callback.\n * @param ctx The context data.\n * @return newCtx The current context of the transaction.\n *\n * @custom:note \n * - State changes is permitted.\n * - Revert is not permitted.\n */\n function afterAgreementTerminated(\n ISuperToken superToken,\n address agreementClass,\n bytes32 agreementId,\n bytes calldata agreementData,\n bytes calldata cbdata,\n bytes calldata ctx\n )\n external\n returns (bytes memory newCtx);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluidGovernance } from \"./ISuperfluidGovernance.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperTokenFactory } from \"./ISuperTokenFactory.sol\";\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperApp } from \"./ISuperApp.sol\";\nimport {\n BatchOperation,\n ContextDefinitions,\n FlowOperatorDefinitions,\n SuperAppDefinitions,\n SuperfluidGovernanceConfigs\n} from \"./Definitions.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\n\n/**\n * @title Host interface\n * @author Superfluid\n * @notice This is the central contract of the system where super agreement, super app\n * and super token features are connected.\n *\n * The Superfluid host contract is also the entry point for the protocol users,\n * where batch call and meta transaction are provided for UX improvements.\n *\n */\ninterface ISuperfluid {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n // Superfluid Custom Errors\n error HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION(); // 0xef4295f6\n error HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE(); // 0x474e7641\n error HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x0cd0ebc2\n error HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS(); // 0x473f7bd4\n error HOST_INVALID_CONFIG_WORD(); // 0xf4c802a4\n error HOST_MAX_256_AGREEMENTS(); // 0x7c281a78\n error HOST_NON_UPGRADEABLE(); // 0x14f72c9f\n error HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX(); // 0x67e9985b\n error HOST_ONLY_GOVERNANCE(); // 0xc5d22a4e\n error HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE(); // 0xb4770115\n error HOST_AGREEMENT_ALREADY_REGISTERED(); // 0xdc9ddba8\n error HOST_AGREEMENT_IS_NOT_REGISTERED(); // 0x1c9e9bea\n error HOST_MUST_BE_CONTRACT(); // 0xd4f6b30c\n error HOST_ONLY_LISTED_AGREEMENT(); // 0x619c5359\n error HOST_NEED_MORE_GAS(); // 0xd4f5d496\n\n // App Related Custom Errors\n // uses SuperAppDefinitions' App Jail Reasons as _code\n error APP_RULE(uint256 _code); // 0xa85ba64f\n\n error HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY(); // 0x19ab84d1\n error HOST_NOT_A_SUPER_APP(); // 0x163cbe43\n error HOST_NO_APP_REGISTRATION_PERMISSIONS(); // 0x5b93ebf0\n error HOST_RECEIVER_IS_NOT_SUPER_APP(); // 0x96aa315e\n error HOST_SENDER_IS_NOT_SUPER_APP(); // 0xbacfdc40\n error HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL(); // 0x44725270\n error HOST_SUPER_APP_IS_JAILED(); // 0x02384b64\n error HOST_SUPER_APP_ALREADY_REGISTERED(); // 0x01b0a935\n error HOST_UNAUTHORIZED_SUPER_APP_FACTORY(); // 0x289533c5\n\n /**************************************************************************\n * Time\n *\n * > The Oracle: You have the sight now, Neo. You are looking at the world without time.\n * > Neo: Then why can't I see what happens to her?\n * > The Oracle: We can never see past the choices we don't understand.\n * > - The Oracle and Neo conversing about the future of Trinity and the effects of Neo's choices\n *************************************************************************/\n\n function getNow() external view returns (uint256);\n\n /**************************************************************************\n * Governance\n *************************************************************************/\n\n /**\n * @dev Get the current governance address of the Superfluid host\n */\n function getGovernance() external view returns(ISuperfluidGovernance governance);\n\n /**\n * @dev Replace the current governance with a new one\n */\n function replaceGovernance(ISuperfluidGovernance newGov) external;\n /**\n * @dev Governance replaced event\n * @param oldGov Address of the old governance contract\n * @param newGov Address of the new governance contract\n */\n event GovernanceReplaced(ISuperfluidGovernance oldGov, ISuperfluidGovernance newGov);\n\n /**************************************************************************\n * Agreement Whitelisting\n *************************************************************************/\n\n /**\n * @dev Register a new agreement class to the system\n * @param agreementClassLogic Initial agreement class code\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function registerAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class registered event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type registered\n * @param code Address of the new agreement\n */\n event AgreementClassRegistered(bytes32 agreementType, address code);\n\n /**\n * @dev Update code of an agreement class\n * @param agreementClassLogic New code for the agreement class\n *\n * @custom:modifiers \n * - onlyGovernance\n */\n function updateAgreementClass(ISuperAgreement agreementClassLogic) external;\n /**\n * @notice Agreement class updated event\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param agreementType The agreement type updated\n * @param code Address of the new agreement\n */\n event AgreementClassUpdated(bytes32 agreementType, address code);\n\n /**\n * @notice Check if the agreement type is whitelisted\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function isAgreementTypeListed(bytes32 agreementType) external view returns(bool yes);\n\n /**\n * @dev Check if the agreement class is whitelisted\n */\n function isAgreementClassListed(ISuperAgreement agreementClass) external view returns(bool yes);\n\n /**\n * @notice Get agreement class\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n */\n function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);\n\n /**\n * @dev Map list of the agreement classes using a bitmap\n * @param bitmap Agreement class bitmap\n */\n function mapAgreementClasses(uint256 bitmap)\n external view\n returns (ISuperAgreement[] memory agreementClasses);\n\n /**\n * @notice Create a new bitmask by adding a agreement class to it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function addToAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**\n * @notice Create a new bitmask by removing a agreement class from it\n * @dev agreementType is the keccak256 hash of: \"org.superfluid-finance.agreements..\"\n * @param bitmap Agreement class bitmap\n */\n function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)\n external view\n returns (uint256 newBitmap);\n\n /**************************************************************************\n * Super Token Factory\n **************************************************************************/\n\n /**\n * @dev Get the super token factory\n * @return factory The factory\n */\n function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);\n\n /**\n * @dev Get the super token factory logic (applicable to upgradable deployment)\n * @return logic The factory logic\n */\n function getSuperTokenFactoryLogic() external view returns (address logic);\n\n /**\n * @dev Update super token factory\n * @param newFactory New factory logic\n */\n function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;\n /**\n * @dev SuperToken factory updated event\n * @param newFactory Address of the new factory\n */\n event SuperTokenFactoryUpdated(ISuperTokenFactory newFactory);\n\n /**\n * @notice Update the super token logic to the latest\n * @dev Refer to ISuperTokenFactory.Upgradability for expected behaviours\n */\n function updateSuperTokenLogic(ISuperToken token) external;\n /**\n * @dev SuperToken logic updated event\n * @param code Address of the new SuperToken logic\n */\n event SuperTokenLogicUpdated(ISuperToken indexed token, address code);\n\n /**************************************************************************\n * App Registry\n *************************************************************************/\n\n /**\n * @dev Message sender (must be a contract) declares itself as a super app.\n * @custom:deprecated you should use `registerAppWithKey` or `registerAppByFactory` instead,\n * because app registration is currently governance permissioned on mainnets.\n * @param configWord The super app manifest configuration, flags are defined in\n * `SuperAppDefinitions`\n */\n function registerApp(uint256 configWord) external;\n /**\n * @dev App registered event\n * @param app Address of jailed app\n */\n event AppRegistered(ISuperApp indexed app);\n\n /**\n * @dev Message sender declares itself as a super app.\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.\n * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.\n * While the message sender must be the super app itself, the transaction sender (tx.origin)\n * must be the deployer account the registration key was issued for.\n */\n function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;\n\n /**\n * @dev Message sender (must be a contract) declares app as a super app\n * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`\n * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.\n * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide\n */\n function registerAppByFactory(ISuperApp app, uint256 configWord) external;\n\n /**\n * @dev Query if the app is registered\n * @param app Super app address\n */\n function isApp(ISuperApp app) external view returns(bool);\n\n /**\n * @dev Query app callbacklevel\n * @param app Super app address\n */\n function getAppCallbackLevel(ISuperApp app) external view returns(uint8 appCallbackLevel);\n\n /**\n * @dev Get the manifest of the super app\n * @param app Super app address\n */\n function getAppManifest(\n ISuperApp app\n )\n external view\n returns (\n bool isSuperApp,\n bool isJailed,\n uint256 noopMask\n );\n\n /**\n * @dev Query if the app has been jailed\n * @param app Super app address\n */\n function isAppJailed(ISuperApp app) external view returns (bool isJail);\n\n /**\n * @dev Whitelist the target app for app composition for the source app (msg.sender)\n * @param targetApp The target super app address\n */\n function allowCompositeApp(ISuperApp targetApp) external;\n\n /**\n * @dev Query if source app is allowed to call the target app as downstream app\n * @param app Super app address\n * @param targetApp The target super app address\n */\n function isCompositeAppAllowed(\n ISuperApp app,\n ISuperApp targetApp\n )\n external view\n returns (bool isAppAllowed);\n\n /**************************************************************************\n * Agreement Framework\n *\n * Agreements use these function to trigger super app callbacks, updates\n * app credit and charge gas fees.\n *\n * These functions can only be called by registered agreements.\n *************************************************************************/\n\n /**\n * @dev (For agreements) StaticCall the app before callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return cbdata Data returned from the callback.\n */\n function callAppBeforeCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory cbdata);\n\n /**\n * @dev (For agreements) Call the app after callback\n * @param app The super app.\n * @param callData The call data sending to the super app.\n * @param isTermination Is it a termination callback?\n * @param ctx Current ctx, it will be validated.\n * @return newCtx The current context of the transaction.\n */\n function callAppAfterCallback(\n ISuperApp app,\n bytes calldata callData,\n bool isTermination,\n bytes calldata ctx\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns(bytes memory newCtx);\n\n /**\n * @dev (For agreements) Create a new callback stack\n * @param ctx The current ctx, it will be validated.\n * @param app The super app.\n * @param appCreditGranted App credit granted so far.\n * @param appCreditUsed App credit used so far.\n * @return newCtx The current context of the transaction.\n */\n function appCallbackPush(\n bytes calldata ctx,\n ISuperApp app,\n uint256 appCreditGranted,\n int256 appCreditUsed,\n ISuperfluidToken appCreditToken\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Pop from the current app callback stack\n * @param ctx The ctx that was pushed before the callback stack.\n * @param appCreditUsedDelta App credit used by the app.\n * @return newCtx The current context of the transaction.\n *\n * @custom:security\n * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.\n * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.\n */\n function appCallbackPop(\n bytes calldata ctx,\n int256 appCreditUsedDelta\n )\n external\n // onlyAgreement\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Use app credit.\n * @param ctx The current ctx, it will be validated.\n * @param appCreditUsedMore See app credit for more details.\n * @return newCtx The current context of the transaction.\n */\n function ctxUseCredit(\n bytes calldata ctx,\n int256 appCreditUsedMore\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev (For agreements) Jail the app.\n * @param app The super app.\n * @param reason Jail reason code.\n * @return newCtx The current context of the transaction.\n */\n function jailApp(\n bytes calldata ctx,\n ISuperApp app,\n uint256 reason\n )\n external\n // onlyAgreement\n // assertValidCtx(ctx)\n returns (bytes memory newCtx);\n\n /**\n * @dev Jail event for the app\n * @param app Address of jailed app\n * @param reason Reason the app is jailed (see Definitions.sol for the full list)\n */\n event Jail(ISuperApp indexed app, uint256 reason);\n\n /**************************************************************************\n * Contextless Call Proxies\n *\n * NOTE: For EOAs or non-app contracts, they are the entry points for interacting\n * with agreements or apps.\n *\n * NOTE: The contextual call data should be generated using\n * abi.encodeWithSelector. The context parameter should be set to \"0x\",\n * an empty bytes array as a placeholder to be replaced by the host\n * contract.\n *************************************************************************/\n\n /**\n * @dev Call agreement function\n * @param agreementClass The agreement address you are calling\n * @param callData The contextual call data with placeholder ctx\n * @param userData Extra user data being sent to the super app callbacks\n */\n function callAgreement(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData\n )\n external\n //cleanCtx\n //isAgreement(agreementClass)\n returns(bytes memory returnedData);\n\n /**\n * @notice Call app action\n * @dev Main use case is calling app action in a batch call via the host\n * @param callData The contextual call data\n *\n * @custom:note See \"Contextless Call Proxies\" above for more about contextual call data.\n */\n function callAppAction(\n ISuperApp app,\n bytes calldata callData\n )\n external\n //cleanCtx\n //isAppActive(app)\n //isValidAppAction(callData)\n returns(bytes memory returnedData);\n\n /**************************************************************************\n * Contextual Call Proxies and Context Utilities\n *\n * For apps, they must use context they receive to interact with\n * agreements or apps.\n *\n * The context changes must be saved and returned by the apps in their\n * callbacks always, any modification to the context will be detected and\n * the violating app will be jailed.\n *************************************************************************/\n\n /**\n * @dev Context Struct\n *\n * @custom:note on backward compatibility:\n * - Non-dynamic fields are padded to 32bytes and packed\n * - Dynamic fields are referenced through a 32bytes offset to their \"parents\" field (or root)\n * - The order of the fields hence should not be rearranged in order to be backward compatible:\n * - non-dynamic fields will be parsed at the same memory location,\n * - and dynamic fields will simply have a greater offset than it was.\n * - We cannot change the structure of the Context struct because of ABI compatibility requirements\n */\n struct Context {\n //\n // Call context\n //\n // app callback level\n uint8 appCallbackLevel;\n // type of call\n uint8 callType;\n // the system timestamp\n uint256 timestamp;\n // The intended message sender for the call\n address msgSender;\n\n //\n // Callback context\n //\n // For callbacks it is used to know which agreement function selector is called\n bytes4 agreementSelector;\n // User provided data for app callbacks\n bytes userData;\n\n //\n // App context\n //\n // app credit granted\n uint256 appCreditGranted;\n // app credit wanted by the app callback\n uint256 appCreditWantedDeprecated;\n // app credit used, allowing negative values over a callback session\n // the appCreditUsed value over a callback sessions is calculated with:\n // existing flow data owed deposit + sum of the callback agreements\n // deposit deltas \n // the final value used to modify the state is determined by the\n // _adjustNewAppCreditUsed function (in AgreementLibrary.sol) which takes \n // the appCreditUsed value reached in the callback session and the app\n // credit granted\n int256 appCreditUsed;\n // app address\n address appAddress;\n // app credit in super token\n ISuperfluidToken appCreditToken;\n }\n\n function callAgreementWithContext(\n ISuperAgreement agreementClass,\n bytes calldata callData,\n bytes calldata userData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // onlyAgreement(agreementClass)\n returns (bytes memory newCtx, bytes memory returnedData);\n\n function callAppActionWithContext(\n ISuperApp app,\n bytes calldata callData,\n bytes calldata ctx\n )\n external\n // requireValidCtx(ctx)\n // isAppActive(app)\n returns (bytes memory newCtx);\n\n function decodeCtx(bytes memory ctx)\n external pure\n returns (Context memory context);\n\n function isCtxValid(bytes calldata ctx) external view returns (bool);\n\n /**************************************************************************\n * Batch call\n **************************************************************************/\n /**\n * @dev Batch operation data\n */\n struct Operation {\n // Operation type. Defined in BatchOperation (Definitions.sol)\n uint32 operationType;\n // Operation target\n address target;\n // Data specific to the operation\n bytes data;\n }\n\n /**\n * @dev Batch call function\n * @param operations Array of batch operations\n */\n function batchCall(Operation[] calldata operations) external;\n\n /**\n * @dev Batch call function for trusted forwarders (EIP-2771)\n * @param operations Array of batch operations\n */\n function forwardBatchCall(Operation[] calldata operations) external;\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * TODO: turning these off because solidity-coverage doesn't like it\n *************************************************************************/\n\n /* /// @dev The current superfluid context is clean.\n modifier cleanCtx() virtual;\n\n /// @dev Require the ctx being valid.\n modifier requireValidCtx(bytes memory ctx) virtual;\n\n /// @dev Assert the ctx being valid.\n modifier assertValidCtx(bytes memory ctx) virtual;\n\n /// @dev The agreement is a listed agreement.\n modifier isAgreement(ISuperAgreement agreementClass) virtual;\n\n // onlyGovernance\n\n /// @dev The msg.sender must be a listed agreement.\n modifier onlyAgreement() virtual;\n\n /// @dev The app is registered and not jailed.\n modifier isAppActive(ISuperApp app) virtual; */\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\nimport { ISuperToken } from \"./ISuperToken.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\n\n\n/**\n * @title Superfluid governance interface\n * @author Superfluid\n */\ninterface ISuperfluidGovernance {\n \n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_GOV_ARRAYS_NOT_SAME_LENGTH(); // 0x27743aa6\n error SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD(); // 0xe171980a\n error SF_GOV_MUST_BE_CONTRACT(); // 0x80dddd73\n\n /**\n * @dev Replace the current governance with a new governance\n */\n function replaceGovernance(\n ISuperfluid host,\n address newGov) external;\n\n /**\n * @dev Register a new agreement class\n */\n function registerAgreementClass(\n ISuperfluid host,\n address agreementClass) external;\n\n /**\n * @dev Update logics of the contracts\n *\n * @custom:note \n * - Because they might have inter-dependencies, it is good to have one single function to update them all\n */\n function updateContracts(\n ISuperfluid host,\n address hostNewLogic,\n address[] calldata agreementClassNewLogics,\n address superTokenFactoryNewLogic\n ) external;\n\n /**\n * @dev Update supertoken logic contract to the latest that is managed by the super token factory\n */\n function batchUpdateSuperTokenLogic(\n ISuperfluid host,\n ISuperToken[] calldata tokens) external;\n \n /**\n * @dev Set configuration as address value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n address value\n ) external;\n \n /**\n * @dev Set configuration as uint256 value\n */\n function setConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key,\n uint256 value\n ) external;\n\n /**\n * @dev Clear configuration\n */\n function clearConfig(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key\n ) external;\n\n /**\n * @dev Get configuration as address value\n */\n function getConfigAsAddress(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (address value);\n\n /**\n * @dev Get configuration as uint256 value\n */\n function getConfigAsUint256(\n ISuperfluid host,\n ISuperfluidToken superToken,\n bytes32 key) external view returns (uint256 value);\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperAgreement } from \"./ISuperAgreement.sol\";\n\n/**\n * @title Superfluid token interface\n * @author Superfluid\n */\ninterface ISuperfluidToken {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SF_TOKEN_AGREEMENT_ALREADY_EXISTS(); // 0xf05521f6\n error SF_TOKEN_AGREEMENT_DOES_NOT_EXIST(); // 0xdae18809\n error SF_TOKEN_BURN_INSUFFICIENT_BALANCE(); // 0x10ecdf44\n error SF_TOKEN_MOVE_INSUFFICIENT_BALANCE(); // 0x2f4cb941\n error SF_TOKEN_ONLY_LISTED_AGREEMENT(); // 0xc9ff6644\n error SF_TOKEN_ONLY_HOST(); // 0xc51efddd\n\n /**************************************************************************\n * Basic information\n *************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /**\n * @dev Encoded liquidation type data mainly used for handling stack to deep errors\n *\n * @custom:note \n * - version: 1\n * - liquidationType key:\n * - 0 = reward account receives reward (PIC period)\n * - 1 = liquidator account receives reward (Pleb period)\n * - 2 = liquidator account receives reward (Pirate period/bailout)\n */\n struct LiquidationTypeData {\n uint256 version;\n uint8 liquidationType;\n }\n\n /**************************************************************************\n * Real-time balance functions\n *************************************************************************/\n\n /**\n * @dev Calculate the real balance of a user, taking in consideration all agreements of the account\n * @param account for the query\n * @param timestamp Time of balance\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOf(\n address account,\n uint256 timestamp\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit);\n\n /**\n * @notice Calculate the realtime balance given the current host.getNow() value\n * @dev realtimeBalanceOf with timestamp equals to block timestamp\n * @param account for the query\n * @return availableBalance Real-time balance\n * @return deposit Account deposit\n * @return owedDeposit Account owed Deposit\n */\n function realtimeBalanceOfNow(\n address account\n )\n external view\n returns (\n int256 availableBalance,\n uint256 deposit,\n uint256 owedDeposit,\n uint256 timestamp);\n\n /**\n * @notice Check if account is critical\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is critical (should use future)\n * @return isCritical Whether the account is critical\n */\n function isAccountCritical(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is critical now (current host.getNow())\n * @dev A critical account is when availableBalance < 0\n * @param account The account to check\n * @return isCritical Whether the account is critical\n */\n function isAccountCriticalNow(\n address account\n )\n external view\n returns(bool isCritical);\n\n /**\n * @notice Check if account is solvent\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @param timestamp The time we'd like to check if the account is solvent (should use future)\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolvent(\n address account,\n uint256 timestamp\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Check if account is solvent now\n * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance\n * @param account The account to check\n * @return isSolvent True if the account is solvent, false otherwise\n */\n function isAccountSolventNow(\n address account\n )\n external view\n returns(bool isSolvent);\n\n /**\n * @notice Get a list of agreements that is active for the account\n * @dev An active agreement is one that has state for the account\n * @param account Account to query\n * @return activeAgreements List of accounts that have non-zero states for the account\n */\n function getAccountActiveAgreements(address account)\n external view\n returns(ISuperAgreement[] memory activeAgreements);\n\n\n /**************************************************************************\n * Super Agreement hosting functions\n *************************************************************************/\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function createAgreement(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement created event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementCreated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Get data of the agreement\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @return data Data of the agreement\n */\n function getAgreementData(\n address agreementClass,\n bytes32 id,\n uint dataLength\n )\n external view\n returns(bytes32[] memory data);\n\n /**\n * @dev Create a new agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n function updateAgreementData(\n bytes32 id,\n bytes32[] calldata data\n )\n external;\n /**\n * @dev Agreement updated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param data Agreement data\n */\n event AgreementUpdated(\n address indexed agreementClass,\n bytes32 id,\n bytes32[] data\n );\n\n /**\n * @dev Close the agreement\n * @param id Agreement ID\n */\n function terminateAgreement(\n bytes32 id,\n uint dataLength\n )\n external;\n /**\n * @dev Agreement terminated event\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n */\n event AgreementTerminated(\n address indexed agreementClass,\n bytes32 id\n );\n\n /**\n * @dev Update agreement state slot\n * @param account Account to be updated\n *\n * @custom:note \n * - To clear the storage out, provide zero-ed array of intended length\n */\n function updateAgreementStateSlot(\n address account,\n uint256 slotId,\n bytes32[] calldata slotData\n )\n external;\n /**\n * @dev Agreement account state updated event\n * @param agreementClass Contract address of the agreement\n * @param account Account updated\n * @param slotId slot id of the agreement state\n */\n event AgreementStateUpdated(\n address indexed agreementClass,\n address indexed account,\n uint256 slotId\n );\n\n /**\n * @dev Get data of the slot of the state of an agreement\n * @param agreementClass Contract address of the agreement\n * @param account Account to query\n * @param slotId slot id of the state\n * @param dataLength length of the state data\n */\n function getAgreementStateSlot(\n address agreementClass,\n address account,\n uint256 slotId,\n uint dataLength\n )\n external view\n returns (bytes32[] memory slotData);\n\n /**\n * @notice Settle balance from an account by the agreement\n * @dev The agreement needs to make sure that the balance delta is balanced afterwards\n * @param account Account to query.\n * @param delta Amount of balance delta to be settled\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function settleBalance(\n address account,\n int256 delta\n )\n external;\n\n /**\n * @dev Make liquidation payouts (v2)\n * @param id Agreement ID\n * @param liquidationTypeData Data regarding the version of the liquidation schema and the type\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount\n * @param targetAccount Account to be liquidated\n * @param rewardAmount The amount the rewarded account will receive\n * @param targetAccountBalanceDelta The delta amount the target account balance should change by\n *\n * @custom:note \n * - If a bailout is required (bailoutAmount > 0)\n * - the actual reward (single deposit) goes to the executor,\n * - while the reward account becomes the bailout account\n * - total bailout include: bailout amount + reward amount\n * - the targetAccount will be bailed out\n * - If a bailout is not required\n * - the targetAccount will pay the rewardAmount\n * - the liquidator (reward account in PIC period) will receive the rewardAmount\n *\n * @custom:modifiers \n * - onlyAgreement\n */\n function makeLiquidationPayoutsV2\n (\n bytes32 id,\n bytes memory liquidationTypeData,\n address liquidatorAccount,\n bool useDefaultRewardAccount,\n address targetAccount,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta\n ) external;\n /**\n * @dev Agreement liquidation event v2 (including agent account)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param liquidatorAccount Address of the executor of the liquidation\n * @param targetAccount Account of the stream sender\n * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts\n * @param rewardAmount The amount the reward recipient account balance should change by\n * @param targetAccountBalanceDelta The amount the sender account balance should change by\n * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)\n *\n * @custom:note \n * Reward account rule:\n * - if the agreement is liquidated during the PIC period\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount\n * - the targetAccount will pay for the rewardAmount\n * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent\n * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)\n * - the targetAccount will pay for the rewardAmount\n * - if the targetAccount is insolvent\n * - the liquidatorAccount will get the rewardAmount (single deposit)\n * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount\n * - the targetAccount will receive the bailoutAmount\n */\n event AgreementLiquidatedV2(\n address indexed agreementClass,\n bytes32 id,\n address indexed liquidatorAccount,\n address indexed targetAccount,\n address rewardAmountReceiver,\n uint256 rewardAmount,\n int256 targetAccountBalanceDelta,\n bytes liquidationTypeData\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be host contract\n //modifier onlyHost() virtual;\n\n /// @dev The msg.sender must be a listed agreement.\n //modifier onlyAgreement() virtual;\n\n /**************************************************************************\n * DEPRECATED\n *************************************************************************/\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedBy)\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param rewardAccount Account that collect the reward\n * @param rewardAmount Amount of liquidation reward\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event AgreementLiquidated(\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed rewardAccount,\n uint256 rewardAmount\n );\n\n /**\n * @dev System bailout occurred (DEPRECATED BY AgreementLiquidatedBy)\n * @param bailoutAccount Account that bailout the penalty account\n * @param bailoutAmount Amount of account bailout\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n */\n event Bailout(\n address indexed bailoutAccount,\n uint256 bailoutAmount\n );\n\n /**\n * @dev Agreement liquidation event (DEPRECATED BY AgreementLiquidatedV2)\n * @param liquidatorAccount Account of the agent that performed the liquidation.\n * @param agreementClass Contract address of the agreement\n * @param id Agreement ID\n * @param penaltyAccount Account of the agreement to be penalized\n * @param bondAccount Account that collect the reward or bailout accounts\n * @param rewardAmount Amount of liquidation reward\n * @param bailoutAmount Amount of liquidation bailouot\n *\n * @custom:deprecated Use AgreementLiquidatedV2 instead\n *\n * @custom:note \n * Reward account rule:\n * - if bailout is equal to 0, then\n * - the bondAccount will get the rewardAmount,\n * - the penaltyAccount will pay for the rewardAmount.\n * - if bailout is larger than 0, then\n * - the liquidatorAccount will get the rewardAmouont,\n * - the bondAccount will pay for both the rewardAmount and bailoutAmount,\n * - the penaltyAccount will pay for the rewardAmount while get the bailoutAmount.\n */\n event AgreementLiquidatedBy(\n address liquidatorAccount,\n address indexed agreementClass,\n bytes32 id,\n address indexed penaltyAccount,\n address indexed bondAccount,\n uint256 rewardAmount,\n uint256 bailoutAmount\n );\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperfluid } from \"./ISuperfluid.sol\";\nimport { ISuperfluidToken } from \"./ISuperfluidToken.sol\";\nimport { TokenInfo } from \"../tokens/TokenInfo.sol\";\nimport { IERC777 } from \"@openzeppelin/contracts/token/ERC777/IERC777.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IConstantOutflowNFT } from \"./IConstantOutflowNFT.sol\";\nimport { IConstantInflowNFT } from \"./IConstantInflowNFT.sol\";\nimport { IPoolAdminNFT } from \"./IPoolAdminNFT.sol\";\nimport { IPoolMemberNFT } from \"./IPoolMemberNFT.sol\";\n\n/**\n * @title Super token (Superfluid Token + ERC20 + ERC777) interface\n * @author Superfluid\n */\ninterface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER(); // 0xf7f02227\n error SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT(); // 0xfe737d05\n error SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED(); // 0xe3e13698\n error SUPER_TOKEN_NO_UNDERLYING_TOKEN(); // 0xf79cf656\n error SUPER_TOKEN_ONLY_SELF(); // 0x7ffa6648\n error SUPER_TOKEN_ONLY_HOST(); // 0x98f73704\n error SUPER_TOKEN_ONLY_GOV_OWNER(); // 0xd9c7ed08\n error SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS(); // 0x81638627\n error SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS(); // 0xdf070274\n error SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS(); // 0xba2ab184\n error SUPER_TOKEN_MINT_TO_ZERO_ADDRESS(); // 0x0d243157\n error SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS(); // 0xeecd6c9b\n error SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS(); // 0xe219bd39\n error SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED(); // 0x6bef249d\n\n /**\n * @dev Initialize the contract\n */\n function initialize(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n string calldata n,\n string calldata s\n ) external;\n\n /**************************************************************************\n * Immutable variables\n *************************************************************************/\n\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);\n // solhint-disable-next-line func-name-mixedcase\n function CONSTANT_INFLOW_NFT() external view returns (IConstantInflowNFT);\n\n /**************************************************************************\n * TokenInfo & ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the name of the token.\n */\n function name() external view override(IERC777, TokenInfo) returns (string memory);\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() external view override(IERC777, TokenInfo) returns (string memory);\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 {_setupDecimals} is\n * called.\n *\n * @custom:note SuperToken always uses 18 decimals.\n *\n * 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() external view override(TokenInfo) returns (uint8);\n\n /**************************************************************************\n * ERC20 & ERC777\n *************************************************************************/\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() external view override(IERC777, IERC20) returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by an account (`owner`).\n */\n function balanceOf(address account) external view override(IERC777, IERC20) returns(uint256 balance);\n\n /**************************************************************************\n * ERC20\n *************************************************************************/\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external override(IERC20) 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 * @notice This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external override(IERC20) view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:note 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 * @custom:emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external override(IERC20) returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * @return Returns Success a boolean value indicating whether the operation succeeded.\n *\n * @custom:emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\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 * @custom:emits an {Approval} event indicating the updated allowance.\n *\n * @custom:requirements \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) external returns (bool);\n\n /**************************************************************************\n * ERC777\n *************************************************************************/\n\n /**\n * @dev Returns the smallest part of the token that is not divisible. This\n * means all token operations (creation, movement and destruction) must have\n * amounts that are a multiple of this number.\n *\n * @custom:note For super token contracts, this value is always 1\n */\n function granularity() external view override(IERC777) returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * @dev If send or receive hooks are registered for the caller and `recipient`,\n * the corresponding functions will be called with `data` and empty\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function send(address recipient, uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from the caller's account, reducing the\n * total supply and transfers the underlying token to the caller's account.\n *\n * If a send hook is registered for the caller, the corresponding function\n * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - the caller must have at least `amount` tokens.\n */\n function burn(uint256 amount, bytes calldata data) external override(IERC777);\n\n /**\n * @dev Returns true if an account is an operator of `tokenHolder`.\n * Operators can send and burn tokens on behalf of their owners. All\n * accounts are their own operator.\n *\n * See {operatorSend} and {operatorBurn}.\n */\n function isOperatorFor(address operator, address tokenHolder) external override(IERC777) view returns (bool);\n\n /**\n * @dev Make an account an operator of the caller.\n *\n * See {isOperatorFor}.\n *\n * @custom:emits an {AuthorizedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function authorizeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Revoke an account's operator status for the caller.\n *\n * See {isOperatorFor} and {defaultOperators}.\n *\n * @custom:emits a {RevokedOperator} event.\n *\n * @custom:requirements \n * - `operator` cannot be calling address.\n */\n function revokeOperator(address operator) external override(IERC777);\n\n /**\n * @dev Returns the list of default operators. These accounts are operators\n * for all token holders, even if {authorizeOperator} was never called on\n * them.\n *\n * This list is immutable, but individual holders may revoke these via\n * {revokeOperator}, in which case {isOperatorFor} will return false.\n */\n function defaultOperators() external override(IERC777) view returns (address[] memory);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n * be an operator of `sender`.\n *\n * If send or receive hooks are registered for `sender` and `recipient`,\n * the corresponding functions will be called with `data` and\n * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n *\n * @custom:emits a {Sent} event.\n *\n * @custom:requirements \n * - `sender` cannot be the zero address.\n * - `sender` must have at least `amount` tokens.\n * - the caller must be an operator for `sender`.\n * - `recipient` cannot be the zero address.\n * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n * The caller must be an operator of `account`.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `data` and `operatorData`. See {IERC777Sender}.\n *\n * @custom:emits a {Burned} event.\n *\n * @custom:requirements \n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n * - the caller must be an operator for `account`.\n */\n function operatorBurn(\n address account,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) external override(IERC777);\n\n /**************************************************************************\n * SuperToken custom token functions\n *************************************************************************/\n\n /**\n * @dev Mint new tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfMint(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Burn existing tokens for the account\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfBurn(\n address account,\n uint256 amount,\n bytes memory userData\n ) external;\n\n /**\n * @dev Transfer `amount` tokens from the `sender` to `recipient`.\n * If `spender` isn't the same as `sender`, checks if `spender` has allowance to\n * spend tokens of `sender`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfTransferFrom(\n address sender,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Give `spender`, `amount` allowance to spend the tokens of\n * `account`.\n *\n * @custom:modifiers \n * - onlySelf\n */\n function selfApproveFor(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n /**************************************************************************\n * SuperToken extra functions\n *************************************************************************/\n\n /**\n * @dev Transfer all available balance from `msg.sender` to `recipient`\n */\n function transferAll(address recipient) external;\n\n /**************************************************************************\n * ERC20 wrapping\n *************************************************************************/\n\n /**\n * @dev Return the underlying token contract\n * @return tokenAddr Underlying token address\n */\n function getUnderlyingToken() external view returns(address tokenAddr);\n\n /**\n * @dev Upgrade ERC20 to SuperToken.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n */\n function upgrade(uint256 amount) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken and transfer immediately\n * @param to The account to receive upgraded tokens\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n * @param data User data for the TokensRecipient callback\n *\n * @custom:note It will use `transferFrom` to get tokens. Before calling this\n * function you should `approve` this contract\n * \n * @custom:warning\n * - there is potential of reentrancy IF the \"to\" account is a registered ERC777 recipient.\n * @custom:requirements \n * - if `data` is NOT empty AND `to` is a contract, it MUST be a registered ERC777 recipient otherwise it reverts.\n */\n function upgradeTo(address to, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev Token upgrade event\n * @param account Account where tokens are upgraded to\n * @param amount Amount of tokens upgraded (in 18 decimals)\n */\n event TokenUpgraded(\n address indexed account,\n uint256 amount\n );\n\n /**\n * @dev Downgrade SuperToken to ERC20.\n * @dev It will call transfer to send tokens\n * @param amount Number of tokens to be downgraded\n */\n function downgrade(uint256 amount) external;\n\n /**\n * @dev Downgrade SuperToken to ERC20 and transfer immediately\n * @param to The account to receive downgraded tokens\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n */\n function downgradeTo(address to, uint256 amount) external;\n\n /**\n * @dev Token downgrade event\n * @param account Account whose tokens are downgraded\n * @param amount Amount of tokens downgraded\n */\n event TokenDowngraded(\n address indexed account,\n uint256 amount\n );\n\n /**************************************************************************\n * Batch Operations\n *************************************************************************/\n\n /**\n * @dev Perform ERC20 approve by host contract.\n * @param account The account owner to be approved.\n * @param spender The spender of account owner's funds.\n * @param amount Number of tokens to be approved.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationApprove(\n address account,\n address spender,\n uint256 amount\n ) external;\n\n function operationIncreaseAllowance(\n address account,\n address spender,\n uint256 addedValue\n ) external;\n\n function operationDecreaseAllowance(\n address account,\n address spender,\n uint256 subtractedValue\n ) external;\n\n /**\n * @dev Perform ERC20 transferFrom by host contract.\n * @param account The account to spend sender's funds.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationTransferFrom(\n address account,\n address spender,\n address recipient,\n uint256 amount\n ) external;\n\n /**\n * @dev Perform ERC777 send by host contract.\n * @param spender The account where the funds is sent from.\n * @param recipient The recipient of the funds.\n * @param amount Number of tokens to be transferred.\n * @param data Arbitrary user inputted data\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationSend(\n address spender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) external;\n\n /**\n * @dev Upgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be upgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationUpgrade(address account, uint256 amount) external;\n\n /**\n * @dev Downgrade ERC20 to SuperToken by host contract.\n * @param account The account to be changed.\n * @param amount Number of tokens to be downgraded (in 18 decimals)\n *\n * @custom:modifiers \n * - onlyHost\n */\n function operationDowngrade(address account, uint256 amount) external;\n\n // Flow NFT events\n /**\n * @dev Constant Outflow NFT proxy created event\n * @param constantOutflowNFT constant outflow nft address\n */\n event ConstantOutflowNFTCreated(\n IConstantOutflowNFT indexed constantOutflowNFT\n );\n\n /**\n * @dev Constant Inflow NFT proxy created event\n * @param constantInflowNFT constant inflow nft address\n */\n event ConstantInflowNFTCreated(\n IConstantInflowNFT indexed constantInflowNFT\n );\n\n /**************************************************************************\n * Function modifiers for access control and parameter validations\n *\n * While they cannot be explicitly stated in function definitions, they are\n * listed in function definition comments instead for clarity.\n *\n * NOTE: solidity-coverage not supporting it\n *************************************************************************/\n\n /// @dev The msg.sender must be the contract itself\n //modifier onlySelf() virtual\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { ISuperToken } from \"./ISuperToken.sol\";\n\nimport {\n IERC20,\n ERC20WithTokenInfo\n} from \"../tokens/ERC20WithTokenInfo.sol\";\n\n/**\n * @title Super token factory interface\n * @author Superfluid\n */\ninterface ISuperTokenFactory {\n\n /**************************************************************************\n * Errors\n *************************************************************************/\n error SUPER_TOKEN_FACTORY_ALREADY_EXISTS(); // 0x91d67972\n error SUPER_TOKEN_FACTORY_DOES_NOT_EXIST(); // 0x872cac48\n error SUPER_TOKEN_FACTORY_UNINITIALIZED(); // 0x1b39b9b4\n error SUPER_TOKEN_FACTORY_ONLY_HOST(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_NON_UPGRADEABLE_IS_DEPRECATED(); // 0x478b8e83\n error SUPER_TOKEN_FACTORY_ZERO_ADDRESS(); // 0x305c9e82\n\n /**************************************************************************\n * Immutable Variables\n **************************************************************************/\n\n /**\n * @dev Get superfluid host contract address\n */\n function getHost() external view returns(address host);\n\n /// @dev Initialize the contract\n function initialize() external;\n\n /**\n * @notice Get the canonical super token logic.\n */\n function getSuperTokenLogic() external view returns (ISuperToken superToken);\n\n /**\n * @dev Upgradability modes\n */\n enum Upgradability {\n /// Non upgradable super token, `host.updateSuperTokenLogic` will revert\n NON_UPGRADABLE,\n /// Upgradable through `host.updateSuperTokenLogic` operation\n SEMI_UPGRADABLE,\n /// Always using the latest super token logic\n FULL_UPGRADABLE\n }\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token\n * @param underlyingToken Underlying ERC20 token\n * @param underlyingDecimals Underlying token decimals\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n */\n function createERC20Wrapper(\n IERC20 underlyingToken,\n uint8 underlyingDecimals,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Create new super token wrapper for the underlying ERC20 token with extra token info\n * @param underlyingToken Underlying ERC20 token\n * @param upgradability Upgradability mode\n * @param name Super token name\n * @param symbol Super token symbol\n * @return superToken The deployed and initialized wrapper super token\n * NOTE:\n * - It assumes token provide the .decimals() function\n */\n function createERC20Wrapper(\n ERC20WithTokenInfo underlyingToken,\n Upgradability upgradability,\n string calldata name,\n string calldata symbol\n )\n external\n returns (ISuperToken superToken);\n\n /**\n * @notice Creates a wrapper super token AND sets it in the canonical list OR reverts if it already exists\n * @dev salt for create2 is the keccak256 hash of abi.encode(address(_underlyingToken))\n * @param _underlyingToken Underlying ERC20 token\n * @return ISuperToken the created supertoken\n */\n function createCanonicalERC20Wrapper(ERC20WithTokenInfo _underlyingToken)\n external\n returns (ISuperToken);\n\n /**\n * @notice Computes/Retrieves wrapper super token address given the underlying token address\n * @dev We return from our canonical list if it already exists, otherwise we compute it\n * @dev note that this function only computes addresses for SEMI_UPGRADABLE SuperTokens\n * @param _underlyingToken Underlying ERC20 token address\n * @return superTokenAddress Super token address\n * @return isDeployed whether the super token is deployed AND set in the canonical mapping\n */\n function computeCanonicalERC20WrapperAddress(address _underlyingToken)\n external\n view\n returns (address superTokenAddress, bool isDeployed);\n\n /**\n * @notice Gets the canonical ERC20 wrapper super token address given the underlying token address\n * @dev We return the address if it exists and the zero address otherwise\n * @param _underlyingTokenAddress Underlying ERC20 token address\n * @return superTokenAddress Super token address\n */\n function getCanonicalERC20Wrapper(address _underlyingTokenAddress)\n external\n view\n returns (address superTokenAddress);\n\n /**\n * @dev Creates a new custom super token\n * @param customSuperTokenProxy address of the custom supertoken proxy\n */\n function initializeCustomSuperToken(\n address customSuperTokenProxy\n )\n external;\n\n /**\n * @dev Super token logic created event\n * @param tokenLogic Token logic address\n */\n event SuperTokenLogicCreated(ISuperToken indexed tokenLogic);\n\n /**\n * @dev Super token created event\n * @param token Newly created super token address\n */\n event SuperTokenCreated(ISuperToken indexed token);\n\n /**\n * @dev Custom super token created event\n * @param token Newly created custom super token address\n */\n event CustomSuperTokenCreated(ISuperToken indexed token);\n\n}" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { TokenInfo } from \"./TokenInfo.sol\";\n\n/**\n * @title ERC20 token with token info interface\n * @author Superfluid\n * @dev Using abstract contract instead of interfaces because old solidity\n * does not support interface inheriting other interfaces\n * solhint-disable-next-line no-empty-blocks\n *\n */\n// solhint-disable-next-line no-empty-blocks\nabstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >= 0.8.4;\n\n/**\n * @title ERC20 token info interface\n * @author Superfluid\n * @dev ERC20 standard interface does not specify these functions, but\n * often the token implementations have them.\n */\ninterface TokenInfo {\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, usually a shorter version of the\n * name.\n */\n function symbol() external view returns (string memory);\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 {_setupDecimals} is\n * called.\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() external view returns (uint8);\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/libs/CallUtils.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\n/**\n * @title Call utilities library that is absent from the OpenZeppelin\n * @author Superfluid\n */\nlibrary CallUtils {\n\n /// @dev Bubble up the revert from the returnedData (supports Panic, Error & Custom Errors)\n /// @notice This is needed in order to provide some human-readable revert message from a call\n /// @param returnedData Response of the call\n function revertFromReturnedData(bytes memory returnedData) internal pure {\n if (returnedData.length < 4) {\n // case 1: catch all\n revert(\"CallUtils: target revert()\");\n } else {\n bytes4 errorSelector;\n assembly {\n errorSelector := mload(add(returnedData, 0x20))\n }\n if (errorSelector == bytes4(0x4e487b71) /* `seth sig \"Panic(uint256)\"` */) {\n // case 2: Panic(uint256) (Defined since 0.8.0)\n // solhint-disable-next-line max-line-length\n // ref: https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require)\n string memory reason = \"CallUtils: target panicked: 0x__\";\n uint errorCode;\n assembly {\n errorCode := mload(add(returnedData, 0x24))\n let reasonWord := mload(add(reason, 0x20))\n // [0..9] is converted to ['0'..'9']\n // [0xa..0xf] is not correctly converted to ['a'..'f']\n // but since panic code doesn't have those cases, we will ignore them for now!\n let e1 := add(and(errorCode, 0xf), 0x30)\n let e2 := shl(8, add(shr(4, and(errorCode, 0xf0)), 0x30))\n reasonWord := or(\n and(reasonWord, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000),\n or(e2, e1))\n mstore(add(reason, 0x20), reasonWord)\n }\n revert(reason);\n } else {\n // case 3: Error(string) (Defined at least since 0.7.0)\n // case 4: Custom errors (Defined since 0.8.0)\n uint len = returnedData.length;\n assembly {\n revert(add(returnedData, 32), len)\n }\n }\n }\n }\n\n /**\n * @dev Helper method to parse data and extract the method signature (selector).\n *\n * Copied from: https://github.com/argentlabs/argent-contracts/\n * blob/master/contracts/modules/common/Utils.sol#L54-L60\n */\n function parseSelector(bytes memory callData) internal pure returns (bytes4 selector) {\n require(callData.length >= 4, \"CallUtils: invalid callData\");\n // solhint-disable-next-line no-inline-assembly\n assembly {\n selector := mload(add(callData, 0x20))\n }\n }\n\n /**\n * @dev Pad length to 32 bytes word boundary\n */\n function padLength32(uint256 len) internal pure returns (uint256 paddedLen) {\n return ((len / 32) + (((len & 31) > 0) /* rounding? */ ? 1 : 0)) * 32;\n }\n\n /**\n * @dev Validate if the data is encoded correctly with abi.encode(bytesData)\n *\n * Expected ABI Encode Layout:\n * | word 1 | word 2 | word 3 | the rest...\n * | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |\n */\n function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) {\n if (data.length < 64) return false;\n uint bytesOffset;\n uint bytesLen;\n // bytes offset is always expected to be 32\n assembly { bytesOffset := mload(add(data, 32)) }\n if (bytesOffset != 32) return false;\n assembly { bytesLen := mload(add(data, 64)) }\n // the data length should be bytesData.length + 64 + padded bytes length\n return data.length == 64 + padLength32(bytesLen);\n }\n\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport {\n ISuperfluid,\n ISuperToken,\n BatchOperation,\n FlowOperatorDefinitions\n} from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport {\n IConstantFlowAgreementV1\n} from \"../interfaces/agreements/IConstantFlowAgreementV1.sol\";\nimport { ForwarderBase } from \"./ForwarderBase.sol\";\n\n\n/**\n * @title CFAv1Forwarder\n * @author Superfluid\n * The CFAv1Forwarder contract provides an easy to use interface to\n * ConstantFlowAgreementV1 specific functionality of Super Tokens.\n * Instances of this contract can operate on the protocol only if configured as \"trusted forwarder\"\n * by protocol governance.\n */\ncontract CFAv1Forwarder is ForwarderBase {\n error CFA_FWD_INVALID_FLOW_RATE();\n\n IConstantFlowAgreementV1 internal immutable _cfa;\n\n // is tied to a specific instance of host and agreement contracts at deploy time\n constructor(ISuperfluid host) ForwarderBase(host) {\n _cfa = IConstantFlowAgreementV1(address(_host.getAgreementClass(\n keccak256(\"org.superfluid-finance.agreements.ConstantFlowAgreement.v1\")\n )));\n }\n\n /**\n * @notice Sets the given flowrate between msg.sender and a given receiver.\n * If there's no pre-existing flow and `flowrate` non-zero, a new flow is created.\n * If there's an existing flow and `flowrate` non-zero, the flowrate of that flow is updated.\n * If there's an existing flow and `flowrate` zero, the flow is deleted.\n * If the existing and given flowrate are equal, no action is taken.\n * On creation of a flow, a \"buffer\" amount is automatically detracted from the sender account's available balance.\n * If the sender account is solvent when the flow is deleted, this buffer is redeemed to it.\n * @param token Super token address\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrate(ISuperToken token, address receiver, int96 flowrate) external returns (bool) {\n return _setFlowrateFrom(token, msg.sender, receiver, flowrate);\n }\n\n /**\n * @notice Like `setFlowrate`, but can be invoked by an account with flowOperator permissions\n * on behalf of the sender account.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @param flowrate The wanted flowrate in wad/second. Only positive values are valid here.\n * @return bool\n */\n function setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) external returns (bool) {\n return _setFlowrateFrom(token, sender, receiver, flowrate);\n }\n\n /**\n * @notice Get the flowrate of the flow between 2 accounts if exists.\n * @dev Currently, only 0 or 1 flows can exist between 2 accounts. This may change in the future.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return flowrate The flowrate from the sender to the receiver account. Returns 0 if no flow exists.\n */\n function getFlowrate(ISuperToken token, address sender, address receiver) external view\n returns(int96 flowrate)\n {\n (, flowrate, , ) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get all available information about a flow (if exists).\n * If only the flowrate is needed, consider using `getFlowrate` instead.\n * @param token Super token address\n * @param sender The sender of the flow\n * @param receiver The receiver of the flow\n * @return lastUpdated Timestamp of last update (flowrate change) or zero if no flow exists\n * @return flowrate Current flowrate of the flow or zero if no flow exists\n * @return deposit Deposit amount locked as security buffer during the lifetime of the flow\n * @return owedDeposit Extra deposit amount borrowed to a SuperApp receiver by the flow sender\n */\n function getFlowInfo(ISuperToken token, address sender, address receiver) external view\n returns(uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n (lastUpdated, flowrate, deposit, owedDeposit) = _cfa.getFlow(token, sender, receiver);\n }\n\n /**\n * @notice Get the buffer amount required for the given token and flowrate.\n * This amount can vary based on the combination of token, flowrate and chain being queried.\n * The result for a given set of parameters can change over time,\n * because it depends on governance configurable protocol parameters.\n * Changes of the required buffer amount affect only flows created or updated after the change.\n * @param token Super token address\n * @param flowrate The flowrate for which the buffer amount is calculated\n * @return bufferAmount The buffer amount required for the given configuration.\n */\n function getBufferAmountByFlowrate(ISuperToken token, int96 flowrate) external view\n returns (uint256 bufferAmount)\n {\n return _cfa.getDepositRequiredForFlowRate(token, flowrate);\n }\n\n /**\n * @notice Get the net flowrate of an account.\n * @param token Super token address\n * @param account Account to query\n * @return flowrate The net flowrate (aggregate incoming minus aggregate outgoing flowrate), can be negative.\n */\n function getAccountFlowrate(ISuperToken token, address account) external view\n returns (int96 flowrate)\n {\n return _cfa.getNetFlow(token, account);\n }\n\n /**\n * @notice Get aggregated flow information (if any exist) of an account.\n * If only the net flowrate is needed, consider using `getAccountFlowrate` instead.\n * @param token Super token address\n * @param account Account to query\n * @return lastUpdated Timestamp of last update of a flow to or from the account (flowrate change)\n * @return flowrate Current net aggregate flowrate\n * @return deposit Aggregate deposit amount currently locked as security buffer for outgoing flows\n * @return owedDeposit Aggregate extra deposit amount currently borrowed to SuperApps receiving from this account\n */\n function getAccountFlowInfo(ISuperToken token, address account) external view\n returns (uint256 lastUpdated, int96 flowrate, uint256 deposit, uint256 owedDeposit)\n {\n return _cfa.getAccountFlowInfo(token, account);\n }\n\n /**\n * @notice Low-level wrapper of createFlow/createFlowByOperator.\n * If the address of msg.sender is not the same as the address of the `sender` argument,\n * createFlowByOperator is used internally. In this case msg.sender needs to have permission to create flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * Currently, only 1 flow can exist between 2 accounts, thus `createFlow` will fail if one already exists.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second to be set initially\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function createFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _createFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper if updateFlow/updateFlowByOperator.\n * If the address of msg.sender doesn't match the address of the `sender` argument,\n * updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flows\n * on behalf of the given sender account with sufficient flowRateAllowance.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param flowrate The flowrate in wad/second the flow should be updated to\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)\n external returns (bool)\n {\n return _updateFlow(token, sender, receiver, flowrate, userData);\n }\n\n /**\n * @notice Low-level wrapper of deleteFlow/deleteFlowByOperator.\n * If msg.sender isn't the same as sender address, msg.sender needs to have permission\n * to delete flows on behalf of the given sender account.\n * @param token Super token address\n * @param sender Sender address of the flow\n * @param receiver Receiver address of the flow\n * @param userData (optional) User data to be set. Should be set to zero if not needed.\n * @return bool\n */\n function deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n external returns (bool)\n {\n return _deleteFlow(token, sender, receiver, userData);\n }\n\n /**\n * @notice Grants a flowOperator permission to create/update/delete flows on behalf of msg.sender.\n * In order to restrict what a flowOperator can or can't do, the flowOperator account\n * should be a contract implementing the desired restrictions.\n * @param token Super token address\n * @param flowOperator Account to which permissions are granted\n * @return bool\n */\n function grantPermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n FlowOperatorDefinitions.AUTHORIZE_FULL_CONTROL,\n type(int96).max\n );\n }\n\n /**\n * @notice Revokes all permissions previously granted to a flowOperator by msg.sender.\n * Revocation doesn't undo or reset flows previously created/updated by the flowOperator.\n * In order to be sure about the state of flows at the time of revocation, you need to check that state\n * either in the same transaction or after this transaction.\n * @param token Super token address\n * @param flowOperator Account from which permissions are revoked\n * @return bool\n */\n function revokePermissions(ISuperToken token, address flowOperator) external returns (bool)\n {\n return _updateFlowOperatorPermissions(\n token,\n flowOperator,\n 0,\n 0\n );\n }\n\n /**\n * @notice Low-level wrapper of `IConstantFlowAgreementV1.updateFlowOperatorPermissions`\n * @param token Super token address\n * @param flowOperator Account for which permissions are set on behalf of msg.sender\n * @param permissions Bitmask for create/update/delete permission flags. See library `FlowOperatorDefinitions`\n * @param flowrateAllowance Max. flowrate in wad/second the operator can set for individual flows.\n * @return bool\n * @notice flowrateAllowance does NOT restrict the net flowrate a flowOperator is able to set.\n * In order to restrict that, flowOperator needs to be a contract implementing the wanted limitations.\n */\n function updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n external returns (bool)\n {\n return _updateFlowOperatorPermissions(token, flowOperator, permissions, flowrateAllowance);\n }\n\n /**\n * @notice Get the currently set permissions granted to the given flowOperator by the given sender account.\n * @param token Super token address\n * @param sender The account which (possiby) granted permissions\n * @param flowOperator Account to which (possibly) permissions were granted\n * @return permissions A bitmask of the permissions currently granted (or not) by `sender` to `flowOperator`\n * @return flowrateAllowance Max. flowrate in wad/second the flowOperator can set for individual flows.\n */\n function getFlowOperatorPermissions(ISuperToken token, address sender, address flowOperator) external view\n returns (uint8 permissions, int96 flowrateAllowance)\n {\n (, permissions, flowrateAllowance) = _cfa.getFlowOperatorData(token, sender, flowOperator);\n }\n\n /**************************************************************************\n * Internal functions\n *************************************************************************/\n\n function _setFlowrateFrom(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate\n ) internal returns (bool) {\n (, int96 prevFlowRate,,) = _cfa.getFlow(token, sender, receiver);\n\n if (flowrate > 0) {\n if (prevFlowRate == 0) {\n return _createFlow(token, sender, receiver, flowrate, new bytes(0));\n } else if (prevFlowRate != flowrate) {\n return _updateFlow(token, sender, receiver, flowrate, new bytes(0));\n } // else no change, do nothing\n return true;\n } else if (flowrate == 0) {\n if (prevFlowRate > 0) {\n return _deleteFlow(token, sender, receiver, new bytes(0));\n } // else no change, do nothing\n return true;\n } else {\n revert CFA_FWD_INVALID_FLOW_RATE();\n }\n }\n\n function _createFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.createFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.createFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlow(\n ISuperToken token,\n address sender,\n address receiver,\n int96 flowrate,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender ?\n abi.encodeCall(\n _cfa.updateFlow,\n (\n token,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.updateFlowByOperator,\n (\n token,\n sender,\n receiver,\n flowrate,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _deleteFlow(\n ISuperToken token,\n address sender,\n address receiver,\n bytes memory userData\n )\n internal returns (bool)\n {\n bytes memory cfaCallData = sender == msg.sender || receiver == msg.sender ?\n abi.encodeCall(\n _cfa.deleteFlow,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n ) :\n abi.encodeCall(\n _cfa.deleteFlowByOperator,\n (\n token,\n sender,\n receiver,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, userData);\n }\n\n function _updateFlowOperatorPermissions(\n ISuperToken token,\n address flowOperator,\n uint8 permissions,\n int96 flowrateAllowance\n )\n internal returns (bool)\n {\n bytes memory cfaCallData =\n abi.encodeCall(\n _cfa.updateFlowOperatorPermissions,\n (\n token,\n flowOperator,\n permissions,\n flowrateAllowance,\n new bytes(0) // placeholder\n )\n );\n\n return _forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));\n }\n}\n" - }, - "@superfluid-finance/ethereum-contracts/contracts/utils/ForwarderBase.sol": { - "content": "// SPDX-License-Identifier: AGPLv3\npragma solidity 0.8.19;\n\nimport { BatchOperation, ISuperfluid } from \"../interfaces/superfluid/ISuperfluid.sol\";\nimport { CallUtils } from \"../libs/CallUtils.sol\";\n\nabstract contract ForwarderBase {\n ISuperfluid internal immutable _host;\n\n constructor(ISuperfluid host) {\n _host = host;\n }\n\n // compiles the calldata of a single operation for the host invocation and executes it\n function _forwardBatchCall(address target, bytes memory callData, bytes memory userData) internal returns (bool) {\n ISuperfluid.Operation[] memory ops = new ISuperfluid.Operation[](1);\n ops[0] = ISuperfluid.Operation(\n BatchOperation.OPERATION_TYPE_SUPERFLUID_CALL_AGREEMENT, // type\n address(target), // target\n abi.encode( // data\n callData, userData)\n );\n\n bytes memory fwBatchCallData = abi.encodeCall(_host.forwardBatchCall, (ops));\n\n // https://eips.ethereum.org/EIPS/eip-2771\n // we encode the msg.sender as the last 20 bytes per EIP-2771 to extract the original txn signer later on\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returnedData) = address(_host).call(abi.encodePacked(fwBatchCallData, msg.sender));\n\n if (!success) {\n CallUtils.revertFromReturnedData(returnedData);\n }\n\n return true;\n }\n}\n" - }, - "contracts/ExistentialNFT.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.19;\n\nimport {ERC721Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {SuperTokenV1Library} from \"@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nerror ExistentialNFT_TransferIsNotAllowed();\nerror ExistentialNFT_Deprecated(uint256 at);\nerror ExistentialNFT_PaymentOptionIndexOutOfBounds();\n\nstruct PaymentOption {\n ISuperToken incomingFlowToken;\n address recipient;\n int96 requiredFlowRate;\n}\n\n/**\n * @author Superfluid Finance\n * @notice Non-mintable NFT contract that is owned by a user as long as they have a positive flow rate\n * @dev Mirrors the Superfluid Checkout-Builder interface\n */\ncontract ExistentialNFT is ERC721Upgradeable, OwnableUpgradeable {\n using SuperTokenV1Library for ISuperToken;\n using Strings for address;\n using Strings for int96;\n\n PaymentOption[] private paymentOptions;\n string private baseURI;\n uint256 private deprecatedAfter;\n\n /**\n * @notice Initializes the contract setting the given PaymentOptions\n * @dev Array parameters should be the same size.\n */\n function initialize(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory _baseURI\n ) public initializer {\n __ERC721_init(name, symbol);\n\n for (uint256 i = 0; i < incomingFlowTokens.length; i++) {\n paymentOptions.push(\n PaymentOption(\n incomingFlowTokens[i],\n recipients[i],\n requiredFlowRates[i]\n )\n );\n\n baseURI = _baseURI;\n }\n\n __Ownable_init();\n transferOwnership(owner);\n }\n\n /**\n * @notice add a new PaymentOption\n * @param incomingFlowToken - the address of the supertoken\n * @param recipient - the address of the recipient\n * @param requiredFlowRate - the required flow rate\n */\n function addPaymentOption(\n ISuperToken incomingFlowToken,\n address recipient,\n int96 requiredFlowRate\n ) public onlyOwner {\n paymentOptions.push(\n PaymentOption(incomingFlowToken, recipient, requiredFlowRate)\n );\n }\n\n /**\n * @notice remove an existing PaymentOption\n * @param index - the index of the PaymentOption to be removed\n */\n function removePaymentOption(uint256 index) public onlyOwner {\n if (index >= paymentOptions.length) {\n revert ExistentialNFT_PaymentOptionIndexOutOfBounds();\n }\n\n for (uint256 i = index; i < paymentOptions.length - 1; i++) {\n paymentOptions[i] = paymentOptions[i + 1];\n }\n\n paymentOptions.pop();\n }\n\n /**\n * @notice set a time, after which subscriptions are considered deprecated\n * 0 means the NFT is never deprecated\n * @dev only the recipient of the first PaymentOption can call this function\n * @param timestamp - the timestamp after which subscriptions are deprecated\n */\n function setDeprecatedAfter(uint256 timestamp) public onlyOwner {\n deprecatedAfter = timestamp;\n }\n\n /**\n * @notice Overridden balanceOf, returning a value depending on the flow rate of the owner\n * @dev See {IERC721-balanceOf}.\n * @return 1 if the owner has a positive flow rate, 0 otherwise\n */\n function balanceOf(address owner) public view override returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return paymentOption.requiredFlowRate > 0 ? 1 : 0;\n }\n\n /**\n * @notice Overridden tokenURI, returning the URI set at deployment\n * @param tokenId - is the address of the owner\n * @dev See {IERC721-tokenURI}.\n * @return tokenURI - the tokenURI for the owner\n */\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return \"\";\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return \"\";\n }\n\n return balanceOf(owner) == 0 ? \"\" : constructTokenURI(owner);\n }\n\n /**\n * @notice Overridden ownerOf, determines the owner, depending flow rate\n * @param tokenId - is the address of the owner\n * @return @param owner - if they have a positive flow rate, otherwise zero address\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n address owner = address(uint160(tokenId));\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return address(0);\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return address(0);\n }\n\n return balanceOf(owner) == 1 ? owner : address(0);\n }\n\n /**\n * @notice get the tokenId for an owner\n * @dev one address can own only one token\n * @param owner - is the address of the owner\n * @return tokenId - the address converted to uint256, 0 if the owner has no positive flow rate\n */\n function tokenOf(address owner) public view returns (uint256) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n if (paymentOption.incomingFlowToken == ISuperToken(address(0))) {\n return 0;\n }\n\n (uint256 lastUpdated, , , ) = paymentOption\n .incomingFlowToken\n .getFlowInfo(owner, paymentOption.recipient);\n\n if (isDeprecated(lastUpdated)) {\n return 0;\n }\n\n return balanceOf(owner) == 1 ? uint256(uint160(owner)) : 0;\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(address, address, uint256) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice This NFT is not transferable\n * @dev See {IERC721-safeTransferFrom}\n */\n function safeTransferFrom(\n address,\n address,\n uint256,\n bytes memory\n ) public pure override {\n revert ExistentialNFT_TransferIsNotAllowed();\n }\n\n /**\n * @notice get all configured PaymentOptions\n * @return PaymentOption[] - all configured PaymentOptions\n */\n function getPaymentOptions() public view returns (PaymentOption[] memory) {\n return paymentOptions;\n }\n\n /**\n * @notice match the owner to a PaymentOption\n * @param owner - the address of the owner\n * @dev @param result is initialized as an empty PaymentOption, so that if no match is found, an empty PaymentOption is returned\n * if a match is found, it is assigned to @param result, the loop is not broken, so that the last match is returned.\n * @return result PaymentOption - the PaymentOption that matches the owner or an empty PaymentOption\n */\n function getPaymentOptionFor(\n address owner\n ) public view returns (PaymentOption memory result) {\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n PaymentOption memory paymentOption = paymentOptions[i];\n int96 flowRate = paymentOption.incomingFlowToken.getFlowRate(\n owner,\n paymentOption.recipient\n );\n\n if (paymentOption.requiredFlowRate <= flowRate && flowRate != 0) {\n result = paymentOption;\n }\n }\n }\n\n /**\n * @notice Check if the flow is considered deprecated based on the lastUpdated value\n */\n function isDeprecated(uint256 flowLastUpdated) public view returns (bool) {\n return deprecatedAfter > 0 && flowLastUpdated > deprecatedAfter;\n }\n\n /**\n * @notice construct the tokenURI for an owner\n * @param owner - the address of the owner\n * @dev add dynamic queryparamaters at the end of the baseURI.\n * @return tokenURI - the tokenURI for the owner\n */\n function constructTokenURI(\n address owner\n ) private view returns (string memory) {\n PaymentOption memory paymentOption = getPaymentOptionFor(owner);\n\n return\n string.concat(\n baseURI,\n \"&symbol=\",\n symbol(),\n \"&token=\",\n address(paymentOption.incomingFlowToken).toHexString(),\n \"&sender=\",\n owner.toHexString(),\n \"&recipient=\",\n paymentOption.recipient.toHexString(),\n \"&flowrate=\",\n paymentOption.requiredFlowRate.toString(),\n \"&clone=\",\n address(this).toHexString()\n );\n }\n}\n" - }, - "contracts/ExistentialNFTCloneFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {ISuperToken} from \"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ExistentialNFT} from \"./ExistentialNFT.sol\";\n\nerror ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n\ncontract ExistentialNFTCloneFactory is Ownable {\n using Clones for address;\n\n address public implementation;\n\n event ExistentialNFTCloneFactory_CloneDeployed(address indexed clone);\n event ExistentialNFTCloneFactory_ImplementationUpdated(\n address indexed implementation\n );\n\n constructor(address _implementation) Ownable() {\n implementation = _implementation;\n }\n\n function deployClone(\n address owner,\n ISuperToken[] memory incomingFlowTokens,\n address[] memory recipients,\n int96[] memory requiredFlowRates,\n string memory name,\n string memory symbol,\n string memory baseURI\n ) external {\n if (\n !(incomingFlowTokens.length > 0 &&\n incomingFlowTokens.length == recipients.length &&\n incomingFlowTokens.length == requiredFlowRates.length)\n ) {\n revert ExistentialNFTCloneFactory_ArgumentLengthMismatch();\n }\n\n ExistentialNFT clone = ExistentialNFT(implementation.clone());\n\n emit ExistentialNFTCloneFactory_CloneDeployed(address(clone));\n\n clone.initialize(\n owner,\n incomingFlowTokens,\n recipients,\n requiredFlowRates,\n name,\n symbol,\n baseURI\n );\n }\n\n function updateImplementation(address _implementation) external onlyOwner {\n implementation = _implementation;\n\n emit ExistentialNFTCloneFactory_ImplementationUpdated(_implementation);\n }\n}\n" - }, - "contracts/hardhat-dependency-compiler/@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@superfluid-finance/ethereum-contracts/contracts/utils/CFAv1Forwarder.sol';\n" - } - }, - "settings": { - "optimizer": { - "enabled": false, - "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 diff --git a/hardhat.config.ts b/hardhat.config.ts index 51b7ac8..2f45216 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -101,43 +101,16 @@ const hardhatUserConfig: HardhatUserConfig = { url: `${SUPERFLUD_RPC_HOST}/polygon-mainnet`, }, // testnets - "arbitrum-goerli": { - accounts, - chainId: 421613, - url: `${SUPERFLUD_RPC_HOST}/arbitrum-goerli`, - }, "avalanche-fuji": { accounts, chainId: 43113, url: `${SUPERFLUD_RPC_HOST}/avalanche-fuji`, }, - "base-goerli": { - accounts, - chainId: 84531, - url: "https://goerli.base.org", //`${SUPERFLUD_RPC_HOST}/base-goerli`, - gasPrice: 1000000000, - }, - "eth-goerli": { - accounts, - chainId: 5, - url: `${SUPERFLUD_RPC_HOST}/eth-goerli`, - }, - "optimism-goerli": { - accounts, - chainId: 420, - url: `${SUPERFLUD_RPC_HOST}/optimism-goerli`, - gasPrice: 1000000000, - }, "polygon-mumbai": { accounts, chainId: 80001, url: `${SUPERFLUD_RPC_HOST}/polygon-mumbai`, }, - "polygon-zkevm-testnet": { - accounts, - chainId: 1442, - url: `${SUPERFLUD_RPC_HOST}/polygon-zkevm-testnet`, - }, "eth-sepolia": { accounts, chainId: 11155111, @@ -171,11 +144,7 @@ const hardhatUserConfig: HardhatUserConfig = { optimisticEthereum: BLOCK_EXPLORER_API_KEYS.optimistic, polygon: BLOCK_EXPLORER_API_KEYS.polygonScan, // testnets - arbitrumGoerli: BLOCK_EXPLORER_API_KEYS.arbiScan, avalancheFujiTestnet: BLOCK_EXPLORER_API_KEYS.snowTrace, - baseGoerli: BLOCK_EXPLORER_API_KEYS.baseScan, - goerli: BLOCK_EXPLORER_API_KEYS.etherScan, - optimisticGoerli: BLOCK_EXPLORER_API_KEYS.optimistic, polygonMumbai: BLOCK_EXPLORER_API_KEYS.polygonScan, "polygon-zkevm-testnet": BLOCK_EXPLORER_API_KEYS.polygonScanZKEVM, sepolia: BLOCK_EXPLORER_API_KEYS.etherScan,