IPublicLockV11
The PublicLock Interface
Methods
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external pure returns (bytes32 role)
Returns
Name | Type | Description |
---|
role | bytes32 | undefined |
KEY_GRANTER_ROLE
function KEY_GRANTER_ROLE() external pure returns (bytes32 role)
Returns
Name | Type | Description |
---|
role | bytes32 | undefined |
LOCK_MANAGER_ROLE
function LOCK_MANAGER_ROLE() external pure returns (bytes32 role)
Returns
Name | Type | Description |
---|
role | bytes32 | undefined |
addKeyGranter
function addKeyGranter(address account) external nonpayable
Parameters
Name | Type | Description |
---|
account | address | undefined |
addLockManager
function addLockManager(address account) external nonpayable
Parameters
Name | Type | Description |
---|
account | address | undefined |
approve
function approve(address to, uint256 tokenId) external nonpayable
Parameters
Name | Type | Description |
---|
to | address | undefined |
tokenId | uint256 | undefined |
approveBeneficiary
function approveBeneficiary(address _spender, uint256 _amount) external nonpayable returns (bool)
An ERC-20 style approval, allowing the spender to transfer funds directly from this lock.
Parameters
Name | Type | Description |
---|
_spender | address | address that can spend tokens belonging to the lock |
_amount | uint256 | amount of tokens that can be spent by the spender |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
balanceOf
function balanceOf(address _owner) external view returns (uint256 balance)
In the specific case of a Lock, balanceOf
returns only the tokens with a valid expiration timerange
Parameters
Name | Type | Description |
---|
_owner | address | undefined |
Returns
Name | Type | Description |
---|
balance | uint256 | The number of valid keys owned by _keyOwner |
beneficiary
function beneficiary() external view returns (address)
=================================================================== Auto-generated getter functions from public state variables
Returns
Name | Type | Description |
---|
_0 | address | undefined |
burn
function burn(uint256 _tokenId) external nonpayable
Deactivate an existing keythe key will be expired and ownership records will be destroyed
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | the id of token to burn |
cancelAndRefund
function cancelAndRefund(uint256 _tokenId) external nonpayable
allows the key manager to expire a given tokenId and send a refund to the keyOwner based on the amount of time remaining.
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The id of the key to cancel. |
expirationDuration
function expirationDuration() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
expireAndRefundFor
function expireAndRefundFor(uint256 _tokenId, uint256 _amount) external nonpayable
Invoked by a Lock manager to expire the user's key and perform a refund and cancellation of the keyThrows if called by other than a Lock managerThrows if _keyOwner does not have a valid key
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The key id we wish to refund to |
_amount | uint256 | The amount to refund to the key-owner |
extend
function extend(uint256 _value, uint256 _tokenId, address _referrer, bytes _data) external payable
Extend functionThrows if lock is disabled or key does not exist for _recipient. Throws if _recipient == address(0).
Parameters
Name | Type | Description |
---|
_value | uint256 | the number of tokens to pay for this purchase >= the current keyPrice - any applicable discount (_value is ignored when using ETH) |
_tokenId | uint256 | the id of the key to extend |
_referrer | address | address of the user making the referral |
_data | bytes | arbitrary data populated by the front-end which initiated the sale |
freeTrialLength
function freeTrialLength() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
gasRefundValue
function gasRefundValue() external view returns (uint256 _gasRefundValue)
_gasRefundValue price in wei or token in smallest price unit
Returns the value/rpice to be refunded to the sender on purchase
Returns
Name | Type | Description |
---|
_gasRefundValue | uint256 | undefined |
getApproved
function getApproved(uint256 _tokenId) external view returns (address operator)
Get the approved address for a single NFT
Throws if _tokenId
is not a valid NFT.
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The NFT to find the approved address for |
Returns
Name | Type | Description |
---|
operator | address | The approved address for this NFT, or the zero address if there is none |
getCancelAndRefundValue
function getCancelAndRefundValue(address _keyOwner) external view returns (uint256 refund)
Determines how much of a refund a key owner would receive if they issued
Parameters
Name | Type | Description |
---|
_keyOwner | address | The key owner to get the refund value for. a cancelAndRefund block.timestamp. Note that due to the time required to mine a tx, the actual refund amount will be lower than what the user reads from this call. |
Returns
Name | Type | Description |
---|
refund | uint256 | undefined |
getHasValidKey
function getHasValidKey(address _user) external view returns (bool)
Checks if the user has a non-expired key.
Parameters
Name | Type | Description |
---|
_user | address | The address of the key owner |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
getRoleAdmin
function getRoleAdmin(bytes32 role) external view returns (bytes32)
Innherited from Open Zeppelin AccessControl.sol
Parameters
Name | Type | Description |
---|
role | bytes32 | undefined |
Returns
Name | Type | Description |
---|
_0 | bytes32 | undefined |
getTransferFee
function getTransferFee(uint256 _tokenId, uint256 _time) external view returns (uint256)
Determines how much of a fee would need to be paid in order to transfer to another account. This is pro-rated so the fee goes down overtime.
Throws if _tokenId does not have a valid key
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The id of the key check the transfer fee for. |
_time | uint256 | The amount of time to calculate the fee for. |
Returns
Name | Type | Description |
---|
_0 | uint256 | The transfer fee in seconds. |
grantKeyExtension
function grantKeyExtension(uint256 _tokenId, uint256 _duration) external nonpayable
Allows the Lock owner to extend an existing keys with no charge.
set _duration
to 0 to use the default duration of the lock
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The id of the token to extend |
_duration | uint256 | The duration in secondes to add ot the key |
grantKeys
function grantKeys(address[] _recipients, uint256[] _expirationTimestamps, address[] _keyManagers) external nonpayable
Allows a Lock manager to give a collection of users a key with no charge. Each key may be assigned a different expiration date.
Throws if called by other than a Lock manager
Parameters
Name | Type | Description |
---|
_recipients | address[] | An array of receiving addresses |
_expirationTimestamps | uint256[] | An array of expiration Timestamps for the keys being granted |
_keyManagers | address[] | undefined |
grantRole
function grantRole(bytes32 role, address account) external nonpayable
Parameters
Name | Type | Description |
---|
role | bytes32 | undefined |
account | address | undefined |
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
Parameters
Name | Type | Description |
---|
role | bytes32 | undefined |
account | address | undefined |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
initialize
function initialize(address _lockCreator, uint256 _expirationDuration, address _tokenAddress, uint256 _keyPrice, uint256 _maxNumberOfKeys, string _lockName) external nonpayable
Functions
Parameters
Name | Type | Description |
---|
_lockCreator | address | undefined |
_expirationDuration | uint256 | undefined |
_tokenAddress | address | undefined |
_keyPrice | uint256 | undefined |
_maxNumberOfKeys | uint256 | undefined |
_lockName | string | undefined |
isApprovedForAll
function isApprovedForAll(address _owner, address _operator) external view returns (bool)
Tells whether an operator is approved by a given keyManager
Parameters
Name | Type | Description |
---|
_owner | address | owner address which you want to query the approval of |
_operator | address | operator address which you want to query the approval of |
Returns
Name | Type | Description |
---|
_0 | bool | bool whether the given operator is approved by the given owner |
isKeyGranter
function isKeyGranter(address account) external view returns (bool)
Parameters
Name | Type | Description |
---|
account | address | undefined |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
isLockManager
function isLockManager(address account) external view returns (bool)
Parameters
Name | Type | Description |
---|
account | address | undefined |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
isOwner
function isOwner(address account) external nonpayable returns (bool)
Parameters
Name | Type | Description |
---|
account | address | undefined |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
isValidKey
function isValidKey(uint256 _tokenId) external view returns (bool)
Check if a certain key is validthis makes use of the onValidKeyHook if it is set
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | the id of the key to check validity |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
keyExpirationTimestampFor
function keyExpirationTimestampFor(uint256 _tokenId) external view returns (uint256 timestamp)
Returns the key's ExpirationTimestamp field for a given owner.Returns 0 if the owner has never owned a key for this lock
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | the id of the key |
Returns
Name | Type | Description |
---|
timestamp | uint256 | undefined |
keyManagerOf
function keyManagerOf(uint256) external view returns (address)
Parameters
Name | Type | Description |
---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|
_0 | address | undefined |
keyPrice
function keyPrice() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
lendKey
function lendKey(address from, address to, uint256 tokenId) external nonpayable
Lending a key allows you to transfer the token while retaining the ownerships right by setting yourself as a key manager first. This function can only called by 1) the key owner when no key manager is set or 2) the key manager. After calling the function, the _recipent
will be the new owner, and the sender of the tx will become the key manager.
Parameters
Name | Type | Description |
---|
from | address | the owner of token to transfer |
to | address | the address that will receive the token |
tokenId | uint256 | the id of the token |
maxKeysPerAddress
function maxKeysPerAddress() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | the maximum number of key allowed for a single address |
maxNumberOfKeys
function maxNumberOfKeys() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
mergeKeys
function mergeKeys(uint256 _tokenIdFrom, uint256 _tokenIdTo, uint256 _amount) external nonpayable
Merge existing keys
Parameters
Name | Type | Description |
---|
_tokenIdFrom | uint256 | the id of the token to substract time from |
_tokenIdTo | uint256 | the id of the destination token to add time |
_amount | uint256 | the amount of time to transfer (in seconds) |
migrate
function migrate(bytes _calldata) external nonpayable
Migrate data from the previous single owner => key mapping to the new data structure w multiple tokens.
when all record schemas are sucessfully upgraded, this function will update the schemaVersion
variable to the latest/current lock version
Parameters
Name | Type | Description |
---|
_calldata | bytes | an ABI-encoded representation of the params (v10: the number of records to migrate as uint ) |
name
function name() external view returns (string _name)
A descriptive name for a collection of NFTs in this contract
Returns
Name | Type | Description |
---|
_name | string | undefined |
numberOfOwners
function numberOfOwners() external view returns (uint256)
Public function which returns the total number of unique owners (both expired and valid). This may be larger than totalSupply.
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
onKeyCancelHook
function onKeyCancelHook() external view returns (address hookAddress)
Returns the address of the onKeyCancelHook
hook.
Returns