✨ New!✨  C4 Cosmos leagueRead more »

Contest ran November 18November 24

7 day contest

Unlock Protocol contest

Protocol for memberships built on a blockchain, where fans can support their favourite creators by purchasing their NFTs!

$50,000 USDC

Total Awards

Unlock Protocol contest details


Unlock is a protocol for memberships that lets creators of all kinds deploy a "membership contract" (we call that a Lock) and that lets them then sell memberships (keys, implemented as NFT).

More high level details can be found there.

You can use the Unlock Dashboard to deploy a lock on Rinkeby and then purchase a key using our "Demo". The following video shows the way to achieve this.


  • Unlock.sol : a factory contract that deploys all locks. It is also called back by the lock on key purchases to mint/distribute new UDT tokens. This contract is deployed once on each network currently supported (Mainnet, xDAI, Polygon, BSC). It is upgradable and currently 'owned' by a Gnosis multisig but will eventually be transfered to the DAO.

  • PublicLock: the actual "membership" contract that implements ERC721 and a few others. It is deployed multiple times by creators.

  • UnlockDiscountTokenV2: the governance token contract (UDT). The only minter is the Unlock contract.

Smart contract docs are available on this page.

Governance docs are available on this page.

Note: the code being reviewed has not been deployed yet, even though it is an incremental upgrade on the existing deployed code. Similarly, the documentation reflects the current implementation, not the code being reviewed. You can find below the most significant change:


You can run test in the smart-contracts repo with yarn run test (make sure you run yarn install first to install all dependencies).

If you want to run the front-end applications, please check instruction in the main Unlock repo.

Upgradable locks

The biggest change we introduced to the smart contract and that we hope to deploy in the next few weeks is to enable upgrades on the PublicLock smart contracts. We want these locks to be upgradable when new versions of the protocol are released, but only by their "Lock Managers" (See permission).

The approach we took is to deploy a Proxy Admin as part of the Unlock.sol contract. We updated the createLock to deploy a lock proxy instead of the lock directly. We also introduced an upgradeLock function that can then be trigger by one of the lock's lock managers to update the implementation.

To support these uprgades, the Unlock contract will now keep a list of implementation, as well the corresponding version numbers as we only support incremental upgrades.