Skip to main content

IUnlockV6

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 _publicLockAddress, string _symbol, string _URI) external nonpayable

Function for the owner to update configuration variables. Should throw if called by other than owner.

Parameters

NameTypeDescription
_publicLockAddressaddressundefined
_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.

globalBaseTokenURI

function globalBaseTokenURI() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

globalTokenSymbol

function globalTokenSymbol() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

initialize

function initialize(address _owner) external nonpayable

Parameters

NameTypeDescription
_owneraddressundefined

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

resetTrackedValue

function resetTrackedValue(uint256 _grossNetworkProduct, uint256 _totalDiscountGranted) external nonpayable

Parameters

NameTypeDescription
_grossNetworkProductuint256undefined
_totalDiscountGranteduint256undefined

Events

ConfigUnlock

event ConfigUnlock(address publicLockAddress, string globalTokenSymbol, string globalTokenURI)

Parameters

NameTypeDescription
publicLockAddressaddressundefined
globalTokenSymbolstringundefined
globalTokenURIstringundefined

NewLock

event NewLock(address indexed lockOwner, address indexed newLockAddress)

Parameters

NameTypeDescription
lockOwner indexedaddressundefined
newLockAddress indexedaddressundefined

ResetTrackedValue

event ResetTrackedValue(uint256 grossNetworkProduct, uint256 totalDiscountGranted)

Parameters

NameTypeDescription
grossNetworkProductuint256undefined
totalDiscountGranteduint256undefined