hasValidKeyon the smart-contract (or
balanceOf). Internally, the lock contract keeps track of the list of members thru the expiration of their membership. So when
hasValidKeyis checked, it simply verifies that the expiration for that specific address is in the future.
hasValidKeymethod so that a 3rd party application could also "override" the default behavior of the
hasValidKeyfunction. If the hook is set, then the contract will call it and use the hook's response to determine if indeed the address should be treated as having a valid key.
Contractand then the
Connect to Web3button in the block explorer. It is important that you do that from an address that is a Lock Manager on your lock (the account you used to deploy the lock is a lock manager).
createMappingform, enter the following values:
_lockAddress: this is the address for your lock (you can get it from your Unlock Dashboard)
_nftAddress: that is the address for your pre-existing NFT contract (ERC721 or ERC1155). Note that this field is called
_tokenAddressin the case of an ERC20.
_tokenTypeId: (only for ERC1155) the id of the type of token to check
_minAmount: (only for ERC20) the minimum amount of ERC20 that should be held
Write. You will be prompted to send a transaction by your wallet. Validate and wait for this to have been executed.
Write as Proxy. Proceed to connect your wallet.
validKeyfunction, so you will enter the address of the hook contract for your network (see list above!) in the
_onValidKeyHookfield. Make sure you add
0x0000000000000000000000000000000000000000in all the other fields to leave them unset.
Write, confirm the transaction in your wallet and you should be all set!