GithubHelp home page GithubHelp logo

olya3209 / lootloose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gakonst/lootloose

0.0 0.0 0.0 481 KB

Open your Loot bags and see what's inside

License: GNU General Public License v3.0

Shell 4.73% JavaScript 2.15% Nix 0.52% Makefile 1.66% Solidity 90.94%

lootloose's Introduction

LootLoose

Open your Loot bags and see what's inside

Github Actions

LootLoose is an ERC-1155 contract which allows you to:

  1. Open your Loot bags and mint 8 ERC-1155 tokens, corresponding to each item in the bag
  2. Re-assemble your ERC721 bag by giving back the ERC-1155 tokens to the contract

Each ERC1155's token URI is a b64 encoded SVG image, with the item's name (just that item's, not any other item from the bag that contained it).

You can mint the 8 ERC-1155 tokens via 2 ways:

  1. approve the LootLoose.sol contract to spend your NFT (or via setApprovalForAll) and calling open.
  2. Transferring your NFT directly to the contract, triggerring the onERC721Received callback

You can reassemble the bag by first approve or setApprovalForAll for the tokens contained in the bag and then calling reassemble.

Average gas cost to open is 322k gas, to reassemble 165k.

A UI is available for these contracts at lootloose.com (repo)

Building and testing

git clone https://github.com/gakonst/lootloose
cd lootloose
make
make test

Installing the toolkit

If you do not have DappTools already installed, you'll need to run the below commands

Install Nix

# User must be in sudoers
curl -L https://nixos.org/nix/install | sh

# Run this or login again to use Nix
. "$HOME/.nix-profile/etc/profile.d/nix.sh"

Install DappTools

curl https://dapp.tools/install | sh

Security Notes

  • In order to improve gas efficiency, OZ's ERC1155.sol was patched to expose the _balances mapping. We use that to do a batch mint inside open.
  • Dom's original LootComponents was modified to be cheaper to use, since it did a lot of redundant SLOADs in hot code paths.

Disclaimer

These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. Paradigm is not liable for any of the foregoing. Users should proceed with caution and use at their own risk.

lootloose's People

Contributors

gakonst avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.