// SPDX-License-Identifier: MIT pragma solidity >=0.5.17 <0.9.0; /** * @title The Unlock Interface **/ interface IUnlockV14 { // Use initialize instead of a constructor to support proxies(for upgradeability via zos). function initialize(address _unlockOwner) external; /** * @dev deploy a ProxyAdmin contract used to upgrade locks */ function initializeProxyAdmin() external; /** * Retrieve the contract address of the proxy admin that manages the locks * @return _proxyAdminAddress the address of the ProxyAdmin instance */ function proxyAdminAddress() external view returns (address _proxyAdminAddress); /** * @notice Create lock (legacy) * This deploys a lock for a creator. It also keeps track of the deployed lock. * @param _expirationDuration the duration of the lock (pass 0 for unlimited duration) * @param _tokenAddress set to the ERC20 token address, or 0 for ETH. * @param _keyPrice the price of each key * @param _maxNumberOfKeys the maximum nimbers of keys to be edited * @param _lockName the name of the lock * param _salt [deprec] -- kept only for backwards copatibility * This may be implemented as a sequence ID or with RNG. It's used with `create2` * to know the lock's address before the transaction is mined. * @dev internally call `createUpgradeableLock` */ function createLock( uint _expirationDuration, address _tokenAddress, uint _keyPrice, uint _maxNumberOfKeys, string calldata _lockName, bytes12 // _salt ) external returns (address); /** * @notice Create lock (default) * This deploys a lock for a creator. It also keeps track of the deployed lock. * @param data bytes containing the call to initialize the lock template * @dev this call is passed as encoded function - for instance: * bytes memory data = abi.encodeWithSignature( * 'initialize(address,uint256,address,uint256,uint256,string)', * msg.sender, * _expirationDuration, * _tokenAddress, * _keyPrice, * _maxNumberOfKeys, * _lockName * ); * @return address of the create lock */ function createUpgradeableLock(bytes memory data) external returns (address); /** * Create an upgradeable lock using a specific PublicLock version * @param data bytes containing the call to initialize the lock template * (refer to createUpgradeableLock for more details) * @param lockVersion the version of the lock to use */ function createUpgradeableLockAtVersion( bytes memory data, uint16 lockVersion ) external returns (address); /** * Create an upgradeable lock using a specific PublicLock version, and execute * transaction(s) on the created lock. * @param data bytes containing the call to initialize the lock template * (refer to createUpgradeableLock for more details). * Importantly, the initial lock manager needs to be set to this contract. * @param lockVersion the version of the lock to use * @param transactions an array of transactions to be executed on the newly * created lock. It is recommended to include a transaction to renounce the * lock manager as the last transaction. */ function createUpgradeableLockAtVersion( bytes memory data, uint16 lockVersion, bytes[] calldata transactions ) external returns (address); /** * @notice Upgrade a lock to a specific version * @dev only available for publicLockVersion > 10 (proxyAdmin /required) * @param lockAddress the existing lock address * @param version the version number you are targeting * Likely implemented with OpenZeppelin TransparentProxy contract */ function upgradeLock( address payable lockAddress, uint16 version ) external returns (address); /** * This function keeps track of the added GDP, as well as grants of discount tokens * to the referrer, if applicable. * The number of discount tokens granted is based on the value of the referal, * the current growth rate and the lock's discount token distribution rate * This function is invoked by a previously deployed lock only. */ function recordKeyPurchase( uint _value, address _referrer // solhint-disable-line no-unused-vars ) external; /** * @notice [DEPRECATED] Call to this function has been removed from PublicLock > v9. * @dev [DEPRECATED] Kept for backwards compatibility * This function will keep track of consumed discounts by a given user. * It will also grant discount tokens to the creator who is granting the discount based on the * amount of discount and compensation rate. * This function is invoked by a previously deployed lock only. */ function recordConsumedDiscount( uint _discount, uint _tokens // solhint-disable-line no-unused-vars ) external view; /** * @notice [DEPRECATED] Call to this function has been removed from PublicLock > v9. * @dev [DEPRECATED] Kept for backwards compatibility * This function returns the discount available for a user, when purchasing a * a key from a lock. * This does not modify the state. It returns both the discount and the number of tokens * consumed to grant that discount. */ function computeAvailableDiscountFor( address _purchaser, // solhint-disable-line no-unused-vars uint _keyPrice // solhint-disable-line no-unused-vars ) external pure returns (uint discount, uint tokens); // Function to read the globalTokenURI field. function globalBaseTokenURI() external view returns (string memory); /** * @dev Redundant with globalBaseTokenURI() for backwards compatibility with v3 & v4 locks. */ function getGlobalBaseTokenURI() external view returns (string memory); // Function to read the globalTokenSymbol field. function globalTokenSymbol() external view returns (string memory); // Function to read the chainId field. function chainId() external view returns (uint); /** * @dev Redundant with globalTokenSymbol() for backwards compatibility with v3 & v4 locks. */ function getGlobalTokenSymbol() external view returns (string memory); /** * @notice Allows the owner to update configuration variables */ function configUnlock( address _udt, address _weth, uint _estimatedGasForPurchase, string calldata _symbol, string calldata _URI, uint _chainId ) external; /** * @notice Add a PublicLock template to be used for future calls to `createLock`. * @dev This is used to upgrade conytract per version number */ function addLockTemplate(address impl, uint16 version) external; /** * Match lock templates addresses with version numbers * @param _version the number of the version of the template * @return _implAddress address of the lock templates */ function publicLockImpls( uint16 _version ) external view returns (address _implAddress); /** * Match version numbers with lock templates addresses * @param _impl the address of the deployed template contract (PublicLock) * @return number of the version corresponding to this address */ function publicLockVersions(address _impl) external view returns (uint16); /** * Retrive the latest existing lock template version * @return _version the version number of the latest template (used to deploy contracts) */ function publicLockLatestVersion() external view returns (uint16 _version); /** * @notice Upgrade the PublicLock template used for future calls to `createLock`. * @dev This will initialize the template and revokeOwnership. */ function setLockTemplate(address payable _publicLockAddress) external; // Allows the owner to change the value tracking variables as needed. function resetTrackedValue( uint _grossNetworkProduct, uint _totalDiscountGranted ) external; function grossNetworkProduct() external view returns (uint); function totalDiscountGranted() external view returns (uint); function locks( address ) external view returns (bool deployed, uint totalSales, uint yieldedDiscountTokens); // The address of the public lock template, used when `createLock` is called function publicLockAddress() external view returns (address); // Map token address to exchange contract address if the token is supported // Used for GDP calculations function uniswapOracles(address) external view returns (address); // The WETH token address, used for value calculations function weth() external view returns (address); // DEPRECATED: An helper function to fetch the governance token address (previously called UDT) function udt() external view returns (address); // The governance token address, used to mint tokens on referral function governanceToken() external view returns (address); // The approx amount of gas required to purchase a key function estimatedGasForPurchase() external view returns (uint); /** * Helper to get the network mining basefee as introduced in EIP-1559 * @dev this helper can be wrapped in try/catch statement to avoid * revert in networks where EIP-1559 is not implemented */ function networkBaseFee() external view returns (uint); // The version number of the current Unlock implementation on this network function unlockVersion() external pure returns (uint16); /** * @notice allows the owner to set the oracle address to use for value conversions * setting the _oracleAddress to address(0) removes support for the token * @dev This will also call update to ensure at least one datapoint has been recorded. */ function setOracle(address _tokenAddress, address _oracleAddress) external; // Initialize the Ownable contract, granting contract ownership to the specified sender function __initializeOwnable(address sender) external; /** * @dev Returns true if the caller is the current owner. */ function isOwner() external view returns (bool); /** * @dev Returns the address of the current owner. */ function owner() external view returns (address); /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() external; /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) external; /** * Set the fee collected by the protocol * @param _protocolFee fee (in basis points) */ function setProtocolFee(uint _protocolFee) external; /** * The fee (in basis points) collected by the protocol on each purchase / extension / renewal of a key * @return the protocol fee in basic point */ function protocolFee() external view returns (uint); /** * Returns the ProxyAdmin contract address that manage upgrades for * the current Unlock contract. * @dev this reads the address directly from storage, at the slot `_ADMIN_SLOT` * defined by Open Zeppelin's EIP1967 Proxy implementation which corresponds * to the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1 */ function getAdmin() external view returns (address); /** * Call executed by a lock after its version upgrade triggred by `upgradeLock` * - PublicLock v12 > v13 (mainnet): migrate an existing Lock to another instance * of the Unlock contract * @dev The `msg.sender` will be the upgraded lock */ function postLockUpgrade() external; /** * Functions which transfers tokens held by the contract * It handles both ERC20 and the base currency. * @dev This function is onlyOwner * @param token the address of the token to transfer (pass the 0x0 address for the base currency) * @param to the address to transfer the tokens to * @param amount the amount of tokens to transfer */ function transferTokens(address token, address to, uint256 amount) external; /** * Removes a lock from the list of locks. This will prevent the lock from being able to receive governance tokens. * The lock will still be able to sell its memberships. * @dev This function is onlyOwner * @param lock address of the lock to remove */ function removeLock(address lock) external; /** * Send tokens held by this contract to the UDT SwapBurner contract. The tokens sent to the * contract are then swapped for UDT and UDT itself will be sent to a burner address. * @notice This function can be called by anyone (not only the contract owner) as a way to ensure decentralization. * @param token the address of the token (zero address for native) to swap and burn * @param amount the amount of tokens to swap and burn * @param poolFee the poolFee of the token - WETH/Wrapped Native asset to use for the swap */ function swapAndBurn(address token, uint256 amount, uint24 poolFee) external; /** * Set the UDT Swap and Burn contract address * @param _swapBurnerAddress the address of the SwapBurner contract instance */ function setSwapBurner(address _swapBurnerAddress) external; /** * The address of the UDT Swap and Burn contract */ function swapBurnerAddress() external view returns (address); /** * Disable an existing lock * @param lockAddress the addres of the lock * @notice after this step, the lock will be unsable */ function burnLock(address lockAddress) external; /** * The implementation used to disable an existing lock */ function burnedLockImpl() external view returns (address); /** * Set the implementation that will be used when disabling a lock * @dev `burnLock` will perform a proxy upgrade of the lock to this contract * @param implAddress an empty implementation contract */ function setBurnedLockImpl(address implAddress) external; }