IPublicLockV4
The PublicLock Interface
Methods
address2Str
function address2Str(address _addr) external pure returns (string)
A utility function for erc721 metadata
Parameters
Name | Type | Description |
---|
_addr | address | An address to convert |
Returns
Name | Type | Description |
---|
_0 | string | undefined |
approve
function approve(address _approved, uint256 _tokenId) external payable
Set or reaffirm the approved address for an NFT
The zero address indicates there is no approved address.Throws unless msg.sender
is the current NFT owner, or an authorized operator of the current owner.
Parameters
Name | Type | Description |
---|
_approved | address | The new approved NFT controller |
_tokenId | uint256 | The NFT to approve |
balanceOf
function balanceOf(address _owner) external view returns (uint256)
In the specific case of a Lock, each owner can own only at most 1 key.
Throws if _owner = address(0)
Parameters
Name | Type | Description |
---|
_owner | address | The address of the key owner |
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
beneficiary
function beneficiary() external view returns (address)
=================================================================== Auto-generated getter functions from public state variables
Returns
Name | Type | Description |
---|
_0 | address | undefined |
cancelAndRefund
function cancelAndRefund() external nonpayable
Destroys the msg.sender's key and sends a refund based on the amount of time remaining.
cancelAndRefundFor
function cancelAndRefundFor(address _keyOwner, bytes _signature) external nonpayable
Cancels a key owned by a different user and sends the funds to the msg.sender.
Parameters
Name | Type | Description |
---|
_keyOwner | address | this user's key will be canceled |
_signature | bytes | getCancelAndRefundApprovalHash signed by the _keyOwner |
destroyLock
function destroyLock() external nonpayable
Used to clean up old lock contracts from the blockchain. TODO: add a check to ensure all keys are INVALID!
Throws if called by other than owner.Throws if lock has not yet been disabled.
disableLock
function disableLock() external nonpayable
Used to disable lock before migrating keys and/or destroying contract.
Throws if called by other than the owner.Throws if lock contract has already been disabled.
expirationDuration
function expirationDuration() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
expireKeyFor
function expireKeyFor(address _owner) external nonpayable
A function which lets the owner of the lock expire a users' key.
Throws if called by other than lock ownerThrows if key owner does not have a valid key
Parameters
Name | Type | Description |
---|
_owner | address | The address of the key owner |
getApproved
function getApproved(uint256 _tokenId) external view returns (address)
Will return the approved recipient for a key, if any.
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The ID of the token we're inquiring about. |
Returns
Name | Type | Description |
---|
_0 | address | undefined |
getCancelAndRefundApprovalHash
function getCancelAndRefundApprovalHash(address _keyOwner, address _txSender) external view returns (bytes32 approvalHash)
returns the hash to sign in order to allow another user to cancel on your behalf.
Parameters
Name | Type | Description |
---|
_keyOwner | address | The key owner's address |
_txSender | address | The address cancelling the key on behalf of the key-owner |
Returns
Name | Type | Description |
---|
approvalHash | bytes32 | undefined |
getCancelAndRefundValueFor
function getCancelAndRefundValueFor(address _owner) external view returns (uint256 refund)
Determines how much of a refund a key owner would receive if they issued
Parameters
Name | Type | Description |
---|
_owner | 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 _owner) external view returns (bool)
Checks if the user has a non-expired key.
Parameters
Name | Type | Description |
---|
_owner | address | The address of the key owner |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
getOwnersByPage
function getOwnersByPage(uint256 _page, uint256 _pageSize) external view returns (address[])
A function which returns a subset of the keys for this Lock as an array
Throws if there are no key owners yet
Parameters
Name | Type | Description |
---|
_page | uint256 | the page of key owners requested when faceted by page size |
_pageSize | uint256 | the number of Key Owners requested per page |
Returns
Name | Type | Description |
---|
_0 | address[] | undefined |
getTokenIdFor
function getTokenIdFor(address _account) external view returns (uint256)
Find the tokenId for a given user
Throws if key owner does not have a valid key
Parameters
Name | Type | Description |
---|
_account | address | The address of the key owner |
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
getTransferFee
function getTransferFee(address _owner) external view returns (uint256)
Determines how much of a fee a key owner would need to pay in order to transfer the key to another account. This is pro-rated so the fee goes down overtime.
Throws if _owner does not have a valid key
Parameters
Name | Type | Description |
---|
_owner | address | The owner of the key check the transfer fee for. |
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
grantKeys
function grantKeys(address[] _recipients, uint256[] _expirationTimestamps) external nonpayable
Allows the Lock owner 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 the lock-owner
Parameters
Name | Type | Description |
---|
_recipients | address[] | An array of receiving addresses |
_expirationTimestamps | uint256[] | An array of expiration Timestamps for the keys being granted |
isAlive
function isAlive() external view returns (bool)
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
isApprovedForAll
function isApprovedForAll(address _owner, address _operator) external view returns (bool)
Tells whether an operator is approved by a given owner
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 | undefined |
isKeyOwner
function isKeyOwner(uint256 _tokenId, address _owner) external view returns (bool)
Checks if the given address owns the given tokenId.
Parameters
Name | Type | Description |
---|
_tokenId | uint256 | The tokenId of the key to check |
_owner | address | The potential key owners address |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
isOwner
function isOwner() external view returns (bool)
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
keyExpirationTimestampFor
function keyExpirationTimestampFor(address _owner) external view returns (uint256 timestamp)
Returns the key's ExpirationTimestamp field for a given owner.Throws if owner has never owned a key for this lock
Parameters
Name | Type | Description |
---|
_owner | address | address of the user for whom we search the key |
Returns
Name | Type | Description |
---|
timestamp | uint256 | undefined |
keyOwnerToNonce
function keyOwnerToNonce(address) external view returns (uint256)
Parameters
Name | Type | Description |
---|
_0 | address | undefined |
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
keyPrice
function keyPrice() external view returns (uint256)
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
maxNumberOfKeys