Unloot the Loot Project: my very first Solidity smart contract deployed on Ethereum
Before digging into why I’ve created Unloot I need to explain a little bit the Loot Project. So bear with me.
The Inspiration: The Loot Project
I think that at this moment everyone knows what the Loot Project is, right? If you still don’t know I will quote directly from their site for a TLDR;
Loot is randomized adventurer gear generated and stored on-chain. It’s a project created by Dom Hofmann. The initial total supply is 8,000 unique bags of adventurer gear. In each bag, you will find 8 items: chest, foot, hand, head, neck, ring, waist, and weapon.
Why is loot so unique?
Loot is unique — the first project of its kind. With no company, art, team, or attributes, Loot makes it impossible to gate-keep any creative decisions (h/t @john_c_palmer).
Loot is the unfiltered, uncensorable building block for stories, experiences, games, and more, in the hands of the community, at no cost. Loot pursues complete decentralization from day one.
At this specific moment, on OpenSea the Loot Project floor price is almost 6 ETH. What does it mean? That if you want to buy the lowest-priced bag it will cost you (with the current ETH-USD conversion) almost $20k.
It’s not a cheap start, right?
I’m fairly new to the web3 world but I’m the kind of person that enjoys learning new things, experiment, build and release.
On Sunday, during a walk, I was thinking about this interesting project and how the current floor price on Open Sea was ruining what could have been an amazing concept to kickstart a whole new kind of project inside the blockchain.
I wanted to allow everyone to play with the Loot Project items but in order to do that people (poor like me :D) should be able to afford to buy at least a basic set of items or at least have the choice to pick whatever items they need to create their adventurer’s equipment.
That’s why while walking I started thinking about a solution and what I could build. The cool thing is that everything is new in web3/solidity and you need a different mental approach to solve issues compared to the “old” mental scheme of web2.
I wanted to create a PoC (proof of concept) in a couple of hours and release an MVP (minimum viable product) without bugs and issues in a couple more.
I got too excited, the idea to create something from scratch, on top of an existing project, on the most bleeding-edge technology at this very moment was too much. I rushed home and started developing…
The Unloot Project
The Unloot project is based on a very simple idea (as I explained before): allow people to afford items to build their equipment set with a low investment.
The smart contract is an ERC721 contract that implements two main functions
You pass the tokenId of your current Loot bag and it will unpack the items contained into your Loot NFT creating eight different Unloot items. Each Unloot NFT is bound to both the original bag and the type of item it represents from the bag.
So for example you own the Loot Bag #3 and you want to unpack it.
The result of the operation would be that you will own eight different Unloot NFT
- Ornate Chestplate
- Great Helm
- Ornate Belt of detection
- Ornate Greaves of Anger
- Dragonskin Gloves
- Gold Ring of Titans
In order to call the unpack function on the contract, you need to approve the Unloot Contract to be able to transfer the Loot Bag to its contract itself. I will not go too deep in technical explanation in this blog post, I will release a specific one where I will explain how to create an identical contract, test it and deploy it on Rinkeby.
But bear with me, I tried a couple of solution to achieve a better user experience but you always arrive at the same point: you need to accept some security or complexity compromise to offer a better experience and sometimes it’s not worth, mostly when you need to deal with the current floor price of a Loot NFT.
Anyway, now you own those items. You can sell them separately on Open Sea, you can transfer a couple to one of your friends that still need a Katana or maybe you can trade one ring with a more powerful chest that you miss to enter that damn dungeon that you cannot defeat with your current inventory!
The repack function (or we can call it un-do? :D) allows you to re-pack eight Unloot NFT into the original Loot bag only if those items you are trying to repack were coming from the same bag.
When the bag is transferred back to your wallet, those Unloot items will be burned.
The cool thing is that you don’t need to be the original owner of the Loot bag to repack it, those items could have been in the hands of many people, used for months, and at some point, you have just luckily found them on OpenSea, available to be bought and repacked in the holy grail of the original one.
Where can I test it?
- Unloot Contract on Rinkeby: 0xd4c4900b0006B39482888d3712c9dBf45a98A2c3
- Loot Contract on Rinkeby (clone of Loot Project just for testing purpose): 0x256AfE6504C04249D74fe7f7EA40575ec6a30bf8
- UI on Rinkeby: https://loot-unloot.surge.sh/
So what can you do at the moment (I know the UI/UX is not great but this is just an MVP to test the idea):
- Go on the Loot Contract tab and claim a Loot Bag (try some not claimed ID)
- You should now see your Bag in the Loot list tab
- Now what you need to do is to go on the Loot Contract and approve the Unloot address to transfer your Loot Bag the Unloot Contract
- Now you can go to the Unloot Contract tab and execute the unpack function. Use your Loot tokenId as input
- If you go to Unloot list you should see your bag exploded into 8 different Unloot NFT item.
- Now you can do whatever you want with those items! Sell them on OpenSea, transfer them to a friend, exchange them with another adventure’s item.
- If you own all the items from a Loot bag you can go to the Unloot Contract tab and repack those items to get back a Loot Bag. The UI is not super easy so you need to remember the ID of Unloot tokenId and input them from the smaller to the bigger one (smaller = sword, bigger = ring).
Why have you developed it?
Mostly because of four reasons
- I want to grow in my web3/solidity path and learn fast
- I like to build things
- I wanted to create something on my own from scratch
- This project allowed me to create content to share with the community that will learn from my experience
Is this project useful?
Yes and no, it could be if other contracts in the Loot Project ecosystem start to recognize and use items from the Unloot contract, otherwise, you would have at worst wasted some gas to just unpack and repack those items.
Are there other projects like this?
Yup, while I was talking with Austin Thomas Griffith on Telegram a couple of days ago showcasing this project he told me that another couple of devs have already released something similar. I’m talking about Loot Loose by Georgios Konstantopoulos