{ "contractName": "CoinMachine", "abi": [ { "anonymous": false, "inputs": [], "name": "ExtensionInitialised", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "authority", "type": "address" } ], "name": "LogSetAuthority", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" } ], "name": "LogSetOwner", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } ], "name": "MetaTransactionExecuted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "activePeriod", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "currentPeriod", "type": "uint256" } ], "name": "PeriodUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bool", "name": "evolvePrice", "type": "bool" } ], "name": "PriceEvolutionSet", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, { "indexed": false, "internalType": "address", "name": "token", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "numTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "totalCost", "type": "uint256" } ], "name": "TokensBought", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "whitelist", "type": "address" } ], "name": "WhitelistSet", "type": "event" }, { "inputs": [], "name": "authority", "outputs": [ { "internalType": "contract DSAuthority", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "bytes", "name": "_payload", "type": "bytes" }, { "internalType": "bytes32", "name": "_sigR", "type": "bytes32" }, { "internalType": "bytes32", "name": "_sigS", "type": "bytes32" }, { "internalType": "uint8", "name": "_sigV", "type": "uint8" } ], "name": "executeMetaTransaction", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "_sig", "type": "bytes4" } ], "name": "getCapabilityRoles", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getChainId", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getColony", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getDeprecated", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract DSAuthority", "name": "authority_", "type": "address" } ], "name": "setAuthority", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "owner_", "type": "address" } ], "name": "setOwner", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "uint256", "name": "_nonce", "type": "uint256" }, { "internalType": "uint256", "name": "_chainId", "type": "uint256" }, { "internalType": "bytes", "name": "_payload", "type": "bytes" }, { "internalType": "bytes32", "name": "_sigR", "type": "bytes32" }, { "internalType": "bytes32", "name": "_sigS", "type": "bytes32" }, { "internalType": "uint8", "name": "_sigV", "type": "uint8" } ], "name": "verify", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_userAddress", "type": "address" } ], "name": "getMetatransactionNonce", "outputs": [ { "internalType": "uint256", "name": "_nonce", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "identifier", "outputs": [ { "internalType": "bytes32", "name": "_identifier", "type": "bytes32" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "version", "outputs": [ { "internalType": "uint256", "name": "_version", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_colony", "type": "address" } ], "name": "install", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "finishUpgrade", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bool", "name": "_deprecated", "type": "bool" } ], "name": "deprecate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "uninstall", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_token", "type": "address" }, { "internalType": "address", "name": "_purchaseToken", "type": "address" }, { "internalType": "uint256", "name": "_periodLength", "type": "uint256" }, { "internalType": "uint256", "name": "_windowSize", "type": "uint256" }, { "internalType": "uint256", "name": "_targetPerPeriod", "type": "uint256" }, { "internalType": "uint256", "name": "_maxPerPeriod", "type": "uint256" }, { "internalType": "uint256", "name": "_userLimitFraction", "type": "uint256" }, { "internalType": "uint256", "name": "_startingPrice", "type": "uint256" }, { "internalType": "address", "name": "_whitelist", "type": "address" } ], "name": "initialise", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_whitelist", "type": "address" } ], "name": "setWhitelist", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_numTokens", "type": "uint256" } ], "name": "buyTokens", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "updatePeriod", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getPurchaseToken", "outputs": [ { "internalType": "address", "name": "_token", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getToken", "outputs": [ { "internalType": "address", "name": "_token", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getActivePeriod", "outputs": [ { "internalType": "uint256", "name": "_period", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getActiveSold", "outputs": [ { "internalType": "uint256", "name": "_sold", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getActiveIntake", "outputs": [ { "internalType": "uint256", "name": "_intake", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEMAIntake", "outputs": [ { "internalType": "uint256", "name": "_amount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getTokenBalance", "outputs": [ { "internalType": "uint256", "name": "_balance", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getPeriodLength", "outputs": [ { "internalType": "uint256", "name": "_length", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getWindowSize", "outputs": [ { "internalType": "uint256", "name": "_size", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getTargetPerPeriod", "outputs": [ { "internalType": "uint256", "name": "_target", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getMaxPerPeriod", "outputs": [ { "internalType": "uint256", "name": "_max", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getCurrentPrice", "outputs": [ { "internalType": "uint256", "name": "_price", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getSellableTokens", "outputs": [ { "internalType": "uint256", "name": "_remaining", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_user", "type": "address" } ], "name": "getUserLimit", "outputs": [ { "internalType": "uint256", "name": "_max", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_user", "type": "address" } ], "name": "getMaxPurchase", "outputs": [ { "internalType": "uint256", "name": "_max", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getWhitelist", "outputs": [ { "internalType": "address", "name": "_whitelist", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEvolvePrice", "outputs": [ { "internalType": "bool", "name": "_evolve", "type": "bool" } ], "stateMutability": "view", "type": "function" } ], "devdoc": { "kind": "dev", "methods": { "buyTokens(uint256)": { "params": { "_numTokens": "The number of tokens to purchase" } }, "deprecate(bool)": { "params": { "_deprecated": "Indicates whether the extension should be deprecated or undeprecated" } }, "executeMetaTransaction(address,bytes,bytes32,bytes32,uint8)": { "params": { "_payload": "Function call to make via meta transaction", "_sigR": "R part of the signature", "_sigS": "S part of the signature", "_sigV": "V part of the signature", "_user": "Address of user trying to do meta transaction" } }, "getActiveIntake()": { "returns": { "_intake": "Amount of tokens received" } }, "getActivePeriod()": { "returns": { "_period": "The active period" } }, "getActiveSold()": { "returns": { "_sold": "Amount of tokens sold" } }, "getCurrentPrice()": { "returns": { "_price": "Current price" } }, "getEMAIntake()": { "returns": { "_amount": "Amount of tokens received" } }, "getEvolvePrice()": { "returns": { "_evolve": "The evolvePrice boolean" } }, "getMaxPerPeriod()": { "returns": { "_max": "Maximum number of tokens" } }, "getMaxPurchase(address)": { "params": { "_user": "The user's address" }, "returns": { "_max": "Maximum amount of tokens" } }, "getMetatransactionNonce(address)": { "params": { "_userAddress": "The user's address" }, "returns": { "_nonce": "The nonce" } }, "getPeriodLength()": { "returns": { "_length": "Length of the sale period" } }, "getPurchaseToken()": { "returns": { "_token": "The token's address" } }, "getSellableTokens()": { "returns": { "_remaining": "Tokens remaining" } }, "getTargetPerPeriod()": { "returns": { "_target": "Target number of tokens" } }, "getToken()": { "returns": { "_token": "The token's address" } }, "getTokenBalance()": { "returns": { "_balance": "Remaining token balance" } }, "getUserLimit(address)": { "params": { "_user": "The user's address" }, "returns": { "_max": "Maximum amount of tokens" } }, "getWhitelist()": { "returns": { "_whitelist": "Address of Whitelist contract" } }, "getWindowSize()": { "returns": { "_size": "Size of the averaging window" } }, "identifier()": { "returns": { "_identifier": "The extension's identifier" } }, "initialise(address,address,uint256,uint256,uint256,uint256,uint256,uint256,address)": { "params": { "_maxPerPeriod": "The maximum number of tokens that can be sold per period", "_periodLength": "How long in seconds each period of the sale should last", "_purchaseToken": "The token to receive payments in. Use 0x0 for ether", "_startingPrice": "The sale price to start at, expressed in units of _purchaseToken per token being sold, as a WAD", "_targetPerPeriod": "The number of tokens to aim to sell per period", "_token": "The token we are selling. Cannot be ether", "_userLimitFraction": "The fraction of the total sale that a single user can buy (in WAD)", "_whitelist": "Optionally an address of a whitelist contract to use can be provided. Pass 0x0 if no whitelist being used", "_windowSize": "Characteristic number of periods that should be used for the moving average. In the long-term, 86% of the weighting will be in this window size. The higher the number, the slower the price will be to adjust" } }, "install(address)": { "params": { "_colony": "The colony in which the extension holds permissions" } }, "setWhitelist(address)": { "params": { "_whitelist": "The address of the whitelist" } }, "version()": { "returns": { "_version": "The extension's version number" } } }, "version": 1 }, "userdoc": { "kind": "user", "methods": { "buyTokens(uint256)": { "notice": "Purchase tokens from Coin Machine." }, "deprecate(bool)": { "notice": "Called when deprecating (or undeprecating) the extension" }, "executeMetaTransaction(address,bytes,bytes32,bytes32,uint8)": { "notice": "Main function to be called when user wants to execute meta transaction. The actual function to be called should be passed as param with name functionSignature Here the basic signature recovery is being used. Signature is expected to be generated using personal_sign method." }, "finishUpgrade()": { "notice": "Called when upgrading the extension" }, "getActiveIntake()": { "notice": "Get the number of tokens received in the period that the price was last updated for or a purchase was made" }, "getActivePeriod()": { "notice": "Get the period that the price was last updated for or a purchase was made" }, "getActiveSold()": { "notice": "Get the number of tokens sold in the period that the price was last updated for or a purchase was made" }, "getCurrentPrice()": { "notice": "Get the current price per token" }, "getEMAIntake()": { "notice": "Get the EMA of the number of tokens received each period" }, "getEvolvePrice()": { "notice": "Get the evolvePrice boolean" }, "getMaxPerPeriod()": { "notice": "Get the maximum number of tokens to sell per period" }, "getMaxPurchase(address)": { "notice": "Get the maximum amount of tokens a user can purchase in a period" }, "getMetatransactionNonce(address)": { "notice": "Gets the next nonce for a meta-transaction" }, "getPeriodLength()": { "notice": "Get the length of the sale period" }, "getPurchaseToken()": { "notice": "Get the address of the token being used to make purchases" }, "getSellableTokens()": { "notice": "Get the number of remaining tokens for sale this period" }, "getTargetPerPeriod()": { "notice": "Get the target number of tokens to sell per period" }, "getToken()": { "notice": "Get the address of the token being sold" }, "getTokenBalance()": { "notice": "Get the remaining balance of tokens" }, "getUserLimit(address)": { "notice": "Get the maximum amount of tokens a user can purchase in total" }, "getWhitelist()": { "notice": "Get the address of the whitelist (if exists)" }, "getWindowSize()": { "notice": "Get the size of the averaging window" }, "identifier()": { "notice": "Returns the identifier of the extension" }, "initialise(address,address,uint256,uint256,uint256,uint256,uint256,uint256,address)": { "notice": "Must be called before any sales can be made" }, "install(address)": { "notice": "Configures the extension" }, "setWhitelist(address)": { "notice": "Set the address for an (optional) whitelist" }, "uninstall()": { "notice": "Called when uninstalling the extension" }, "updatePeriod()": { "notice": "Bring the token accounting current" }, "version()": { "notice": "Returns the version of the extension" } }, "version": 1 } }