Protocol for memberships built on a blockchain, where fans can support their favourite creators by purchasing their NFTs!
Platform: Code4rena
Start Date: 18/11/2021
End Date: 24/11/2021
Period: 7 days
Status: Completed
Pot Size: $50,000 USDC
Participants: 26
Reporter: itsmetechjay
Judge: leastwood
Id: 54
League: ETH
WatchPug | 1/26 | $12,005.46 | 8 | 2 | 2 | 4 | 2 | - | - | 0 |
cmichel | 2/26 | $8,857.88 | 8 | 1 | 1 | 5 | 2 | - | - | 0 |
elprofesor | 3/26 | $5,371.72 | 3 | 1 | 1 | 1 | 0 | - | 0 | 0 |
kenzo | 4/26 | $4,980.49 | 8 | 0 | 0 | 7 | 2 | - | 0 | 0 |
pauliax | 5/26 | $3,322.38 | 3 | 0 | 0 | 1 | 0 | - | - | 0 |
GiveMeTestEther | 6/26 | $2,486.65 | 5 | 0 | 0 | 3 | 0 | - | - | 0 |
0x0x0x | 7/26 | $1,467.49 | 5 | 0 | 0 | 3 | 0 | - | - | 0 |
itsmeSTYJ | 8/26 | $1,302.66 | 3 | 0 | 0 | 2 | 2 | 0 | - | 0 |
loop | 9/26 | $880.39 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
Ruhum | 10/26 | $868.39 | 2 | 0 | 0 | 1 | 0 | - | 0 | 0 |
Auditor per page
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.
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.