About the Unlock Smart Contract
The Unlock contract is a factory contract. Its main purpose is to create new locks based on a template. Additionally, it keeps track of locks after they have been created and grants Unlock tokens when new memberships have been purchased.
As of summer 2021, the unlock contract is owned by a multi-sig wallet managed by Unlock Inc. Our goal is to move toward decentralization by transferring ownership of the Unlock contact to the Unlock DAO.
This contract is upgradable using OpenZeppelin's upgradability framework. As of now, the ProxyAdmin is owned by a multi-sig wallet managed by Unlock Inc. Our goal is to move toward decentralization by transferring ownership of the Unlock contact to the Unlock DAO. Each implementation is versioned. The method unlockVersion()
will yield the current version.
Some functions that are deprecated or not implemented yet (no-op) have been omitted.
createLock
createLock
This function can be invoked by any Ethereum address and creates a new lock using the current template. (see below).
Once minted, the lock belongs to the caller of the function. The Unlock contract also keeps track of each locks' address.
globalBaseTokenURI
globalBaseTokenURI
This read-only function does not modify the state and yields the ERC721 base URL for metadata used by the locks. Each lock can override this.
globalTokenSymbol
globalTokenSymbol
This read-only function does not modify the state and yields the ERC721 base token symbol used by the locks. Each lock can override this.
chainId
chainId
This read-only function does not modify the state and yields the network id on which this Unlock has been deployed. Some functionnality in the protocol differs based on the network (related to our governance token).
configUnlock
configUnlock
This function modifies the state and sets multiple configuration parameters used by the protocol. It can be called several times in order to change the behavior of the protocol, but only by the owner of the Unlock contract.
The _weth
should be the chain's native token ERC20 (or wrapped as an ERC20). On Ethereum's main network, it is wrapped Ether for example.
setLockTemplate
setLockTemplate
This function modifies the state and can only be called by the Unlock contract owner. It sets the template used to deploy locks. The address' should be a lock and its initialize
and revokeOwnership
functions will be called.
resetTrackedValue
resetTrackedValue
This function modifies the state and can only be called by the Unlock contract owner. It changes the gross network product value as well as the amount of discount granted. (note: as of summer 2021, it is unclear whether we will ever implement a discount mechanism, as we will let these decisions to the DAO).
locks
locks
This read-only function does not modify the state. The Unlock contract keeps track of all locks deployed by the protocol. It can be used to check if a lock was deployed using the protocol and yields a triplet of (boolean, total exchanged value recorded, amount of UDT yielded by this lock)
setOracle
setOracle
This function modifies the state and can only be called by the Unlock contract owner. It adds an oracle to the list of oracles, for a specific token address. Since locks can be deployed using any ERC20, we need on-chain oracles to provide a conversion rate in order to compute the revenue added by each purchase.
transferOwnership
transferOwnership
This function modifies the state and can only be called by the Unlock contract owner. It lets the owner transfer ownership to another address. It is a highly sensitive function as the supplied address will get the full control of the protocol after the transfer. We expect this function to only be called to transfer ownership to DAO contracts.
renounceOwnership
renounceOwnership
This function modifies the state and can only be called by the Unlock contract owner. It renounces ownership of the Unlock contract, thereby removing any functionality that is only available to the owner.
Other functions
The functions below are getters (read-only functions).
Last updated