Skip to main content

IUnlockV8

The Unlock Interface*

Methods

computeAvailableDiscountFor

function computeAvailableDiscountFor(address _purchaser, uint256 _keyPrice) external view returns (uint256 discount, uint256 tokens)

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.

Parameters

NameTypeDescription
_purchaseraddressundefined
_keyPriceuint256undefined

Returns

NameTypeDescription
discountuint256undefined
tokensuint256undefined

configUnlock

function configUnlock(address _udt, address _weth, uint256 _estimatedGasForPurchase, string _symbol, string _URI) external nonpayable

Allows the owner to update configuration variables

Parameters

NameTypeDescription
_udtaddressundefined
_wethaddressundefined
_estimatedGasForPurchaseuint256undefined
_symbolstringundefined
_URIstringundefined

createLock

function createLock(uint256 _expirationDuration, address _tokenAddress, uint256 _keyPrice, uint256 _maxNumberOfKeys, string _lockName, bytes12 _salt) external nonpayable

Create lock This deploys a lock for a creator. It also keeps track of the deployed lock.

Parameters

NameTypeDescription
_expirationDurationuint256undefined
_tokenAddressaddressset to the ERC20 token address, or 0 for ETH.
_keyPriceuint256undefined
_maxNumberOfKeysuint256undefined
_lockNamestringundefined
_saltbytes12an identifier for the Lock, which is unique for the user. 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.

estimatedGasForPurchase

function estimatedGasForPurchase() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

getGlobalBaseTokenURI

function getGlobalBaseTokenURI() external view returns (string)

Redundant with globalBaseTokenURI() for backwards compatibility with v3 & v4 locks.

Returns

NameTypeDescription
_0stringundefined

getGlobalTokenSymbol

function getGlobalTokenSymbol() external view returns (string)

Redundant with globalTokenSymbol() for backwards compatibility with v3 & v4 locks.

Returns

NameTypeDescription
_0stringundefined

globalBaseTokenURI

function globalBaseTokenURI() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

globalTokenSymbol

function globalTokenSymbol() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

grossNetworkProduct

function grossNetworkProduct() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

initialize

function initialize(address _unlockOwner) external nonpayable

Parameters

NameTypeDescription
_unlockOwneraddressundefined

isOwner

function isOwner() external view returns (bool)

Returns true if the caller is the current owner.

Returns

NameTypeDescription
_0boolundefined

locks

function locks(address) external view returns (bool deployed, uint256 totalSales, uint256 yieldedDiscountTokens)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
deployedboolundefined
totalSalesuint256undefined
yieldedDiscountTokensuint256undefined

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

publicLockAddress

function publicLockAddress() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

recordConsumedDiscount

function recordConsumedDiscount(uint256 _discount, uint256 _tokens) external nonpayable

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.

Parameters

NameTypeDescription
_discountuint256undefined
_tokensuint256undefined

recordKeyPurchase

function recordKeyPurchase(uint256 _value, address _referrer) external nonpayable

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.

Parameters

NameTypeDescription
_valueuint256undefined
_referreraddressundefined

renounceOwnership

function renounceOwnership() external nonpayable

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.*

resetTrackedValue

function resetTrackedValue(uint256 _grossNetworkProduct, uint256 _totalDiscountGranted) external nonpayable

Parameters

NameTypeDescription
_grossNetworkProductuint256undefined
_totalDiscountGranteduint256undefined

setLockTemplate

function setLockTemplate(address payable _publicLockAddress) external nonpayable

Upgrade the PublicLock template used for future calls to createLock.

This will initialize the template and revokeOwnership.

Parameters

NameTypeDescription
_publicLockAddressaddress payableundefined

setOracle

function setOracle(address _tokenAddress, address _oracleAddress) external nonpayable

allows the owner to set the oracle address to use for value conversions setting the _oracleAddress to address(0) removes support for the token

This will also call update to ensure at least one datapoint has been recorded.

Parameters

NameTypeDescription
_tokenAddressaddressundefined
_oracleAddressaddressundefined

totalDiscountGranted

function totalDiscountGranted() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

udt

function udt() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

uniswapOracles

function uniswapOracles(address) external view returns (address)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
_0addressundefined

unlockVersion

function unlockVersion() external pure returns (uint16)

Returns

NameTypeDescription
_0uint16undefined

weth

function weth() external view returns (address)

Returns

NameTypeDescription
_0addressundefined