Darani

NFTLock

CE4153 β€” Blockchain Tech

Overview
A DApp that "locks" and "unlocks" ERC721 tokens, preventing owners from losing their NFTs to malicious smart contracts.
Role
Full Stack Engineer, Smart Contract Engineer
Timeline
August 2022 to October 2022
Team
T. Daranidarran (Me), Yap Wee Jun, Zhao Chen Xuan Joe
Tech
React, Solidity, OpenZeppelin, HTML, CSS
NFTLock
01Β·Background

Why a DApp to protect NFTs?

NFTs hold significant monetary value β€” USD 100 to USD 100,000. But due to wallet owner negligence, they're lost with a single click. There is a clear need for active safeguards.

Why do NFT owners fall prey to malicious contracts?

1) Recommended hot/cold wallet practices are not followed.

2) Most NFT holders cannot read or understand smart contracts.

3) NFT holders don't have time to scrutinise every contract they sign daily.

02Β·Solution

NFTLock πŸ”’.

A simple, intuitive DApp to "lock" and "unlock" NFTs in your wallet with a single click.

We focused on Ethereum ERC721 tokens, as Ethereum hosts the most valuable NFT collections. Deployed on the GΓΆrli Testnet.

How does this benefit the NFT space?

1) Reduces NFT theft via malicious smart contracts.

2) Promotes a safer environment for learning and experimentation.

3) Welcomes more investors into Web3 by addressing its scam reputation.

03

Smart contract.

The contract "locks" NFTs by sending them to the contract address and "unlocks" them by returning them to the owner β€” similar to staking.

ShogunSamurai staking contract

This contract makes NFTs non-transferable in their "staked" state within the owner wallet. However it was inefficient due to staking reward multiplier logic.

NFTs staked this way can still be listed on secondary marketplaces β€” but the sale transaction will fail due to the non-transferable state, which can manipulate collection floor prices.

I plan to deploy a more efficient version implementing this logic directly.

Code references
ShogunSamurai Staking Contract
filmakarov's Locking Implementation
OwlOfMoistness' Locking Implementation
04

Smart contract issues.

Token addresses were not stored within the contract. This meant tokens with the same ID from different collections would conflict on lock/unlock.

Storing token IDs alongside their collection address would prevent this edge case. A predefined struct within the locking contract would handle this cleanly.

05

Fixes βš’οΈ.

Coming soon.

06Β·Reflection

To the moon πŸŒ–.

A fully functional NFT locking DApp would be revolutionary β€” and it would be the first of its kind. Working on this was exciting because I'm already invested in the NFT/Web3 space.

I've seen countless friends fall prey to scams and malicious contracts. I want to put a stop to this cycle by continuing to build this into a usable solution.

Also, don't sign up for CE4153 at NTU 🀒.