0.1.32 • Published 2 years ago

droplabmods v0.1.32

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago
    ────────╔═══╗───────╔╗───╔╗
    ────────╚╗╔╗║───────║║───║║
    ─────────║║║╠═╦══╦══╣║╔══╣╚═╗
    ─────────║║║║╔╣╔╗║╔╗║║║╔╗║╔╗║
            ╔╝╚╝║║║╚╝║╚╝║╚╣╔╗║╚╝║
            ╚═══╩╝╚══╣╔═╩═╩╝╚╩══╝
    ─────────────────║║   www.thedroplab.com
    ─────────────────╚╝   droplab.eth

DropLab Mods

Selection of components, contracts and scripts to make life easy

  • onChain contracts & deplyment
  • general JS utility scripts
  • ethereum interaction helpers
  • website generic components, helpers and APIs

npm GitHub top language

Installing

#  node.js
npm install droplabmods

#   Then use
#   javascript
import {...} from 'droplabmods';
#   solidity
import 'droplabmods/onChain/contracts/[file/folder...]

Dependencies

  • ethers
  • erc721a
  • @openzepplin/contracts
  • typescript
  • keccak256
  • merkletree.js
  • dotenv

onChain

Deployment

#  Start new deployment from scratch:
truffle migrate --network {network} --reset
#  Continue migration from last deployment:
truffle migrate --network {network}

Replace {network} with network name ie rinkeby

  • Available Networks:
  • homestead ID:1 (Ethereum Mainnet)
  • rinkeby ID:4 (Ethereum testNetwork)
  • kovan ID:42 (Ethereum testNetwork)
  • local ID: 420 (Ethereum localNetwork)
  • polygon ID: 137 (Polygon Mainnet)
  • mumbai ID: 80001 (Polygon testNetwork)

Deployer Wallet: [ethereum address] Deployed On: Rinkeby Test Network (ID: 4)

ABI's are available from import build from './build/contracts/[contractName].json' use the ABI with build.abi

contracts/ERC721/ERC721A-Model.sol

 //Using
import "contracts/ERC721/ERC721A-Model.sol"

//Constructure
ERC721AModel(_startingID, BaseURI)
      
// A contract to sit ontop ERC721A deployments to allow easier modification and managment for tokenURIs
// Also adding a var for startingId.  Meaning no editing of the `erc721a` contract is needed.
//  Hold the base URI
string private BaseURI_;
//  Hold the starting token ID
uint256 private startingID_;
        /**
     *  @dev    Overrights the base function in ERC721A
     */
    function _startTokenId() internal view override returns (uint256) {
        return startingID_;
    }

    /**
     * @dev Base URI for computing {tokenURI}. Overrights the base function in ERC721A
     */
    function _baseURI()
        internal
        view
        override
        returns (string memory)
    {
        return BaseURI_;
    }

    function _setBaseURI(string memory _BaseURI) internal {
        BaseURI_ = _BaseURI;
    }

    /**
     * @dev Returns URI with json extention
     */
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721A)
        returns (string memory)
    {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length != 0
                ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json"))
                : "";
    }
        

contracts/ERC721/spesific_functions/prereviealURI.sol

 //Using
import "contracts/ERC721/spesific_functions/prereviealURI.sol"
      
// Used to triggar URI reveal onchain
 bool public URI_REVEALED = false;
    string private preURI_;

    /**
     * @dev     -   See {IERC721Metadata-tokenURI}
     * @notice  -   Retuns the token metadata URL.  If imageReveald_ == false
     *              it will return the holding URL
     * @param -tokenId {uint256}
     */
    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {

        return
            URI_REVEALED
                ? super.tokenURI(_tokenId)
                : preURI_;
    }

    

    function setPreURI(string memory _newURI)public onlyOwner {
            preURI_ = _newURI;
    }        

File Structure

.
├── README.md
├── index.js
├── isThisWorking.js
├── bin
│   ├── ABIs
│       └── [contractType]-ABI.js
│   └── index.js
├── onChain
│   ├── index.js
│   ├── contracts
│       ├── collectionWrapping
│       ├── ERC20
│       ├── ERC721
│       ├── ERC1155
│       ├── govenance
│       ├── migrations
│       ├── motherContracts
│       ├── sales
│       ├── staking
│       └── utilities
│   └── migrations
├── scripts
│   ├── index.js
│   ├── web3
│   └── helpers
├── types
│   └── index.js
├── web
│   ├── index.js
│   ├── API
│   ├── components
│   ├── helpers
│       └── API
│           └── ethereum
│               ├── contractInteraction
│               ├── getters
│               └── helpers
│   └── hooks
0.1.32

2 years ago

0.1.31

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago