All Projects → szerintedmi → solidity-itMapsLib

szerintedmi / solidity-itMapsLib

Licence: Apache-2.0 license
Iterable maps library for Ethereum Solidity

Projects that are alternatives of or similar to solidity-itMapsLib

solidity-contracts
📦 Resources for the Ethereum Smart Contract Development tutorial series.
Stars: ✭ 64 (+236.84%)
Mutual labels:  ethereum-contract, solidity-contracts
contracts
Contracts for FundRequest (platform, token, crowdsale)
Stars: ✭ 56 (+194.74%)
Mutual labels:  ethereum-contract, solidity-contracts
etherbrite
🗓 Clone eventbrite on Ethereum, built in Solidity, TruffleJS, Web3js and React/Redux.
Stars: ✭ 19 (+0%)
Mutual labels:  ethereum-contract, solidity-contracts
Colonynetwork
Colony Network smart contracts
Stars: ✭ 351 (+1747.37%)
Mutual labels:  ethereum-contract, solidity-contracts
Seriality
Seriality is a library for serializing and de-serializing all the Solidity types in a very efficient way which mostly written in solidity-assembly
Stars: ✭ 105 (+452.63%)
Mutual labels:  ethereum-contract, solidity-contracts
Solidity
🔐 Ethereum smart contracts developed for the Hanzo Platform.
Stars: ✭ 46 (+142.11%)
Mutual labels:  ethereum-contract, solidity-contracts
bitdegree-token-crowdsale
Token Website
Stars: ✭ 26 (+36.84%)
Mutual labels:  ethereum-contract, solidity-contracts
fund-protocol
A blockchain protocol for tokenized hedge funds
Stars: ✭ 85 (+347.37%)
Mutual labels:  ethereum-contract, solidity-contracts
Simple-Game-ERC-721-Token-Template
🔮 Very Simple ERC-721 Smart Contract Template to create your own ERC-721 Tokens on the Ethereum Blockchain, with many customizable Options 🔮
Stars: ✭ 83 (+336.84%)
Mutual labels:  ethereum-contract, solidity-contracts
kirby-map-field
🗺 An easy way to use maps and location data in Kirby.
Stars: ✭ 41 (+115.79%)
Mutual labels:  mapping
CodableWrapper
@codec("encoder", "decoder") var cool: Bool = true
Stars: ✭ 143 (+652.63%)
Mutual labels:  mapping
android
Where you can find everything Android from Mapzen
Stars: ✭ 106 (+457.89%)
Mutual labels:  mapping
CesiumJs3DTileServer
cesiumgis.com/
Stars: ✭ 25 (+31.58%)
Mutual labels:  mapping
dexpay-pos
Dexpay: POS, a modularized and extensible point of sale which enables Merchants to accept payments in ETH, DAI and xDAI.
Stars: ✭ 24 (+26.32%)
Mutual labels:  solidity-contracts
geemap-apps
Interactive web apps created using geemap and streamlit
Stars: ✭ 24 (+26.32%)
Mutual labels:  mapping
GA SLAM
🚀 SLAM for autonomous planetary rovers with global localization
Stars: ✭ 40 (+110.53%)
Mutual labels:  mapping
Poolz-Back
smart contracts using solidity for erc20 tokens to eth and erc20 to erc20
Stars: ✭ 15 (-21.05%)
Mutual labels:  ethereum-contract
soldoc
A solidity documentation generator, based in NatSpec format. 📃 with standalone HTML, pdf, gitbook and docsify output ✏️ just plug and play.
Stars: ✭ 54 (+184.21%)
Mutual labels:  solidity-contracts
goodghosting-smart-contracts
Good Ghosting V1 Contracts
Stars: ✭ 23 (+21.05%)
Mutual labels:  solidity-contracts
morphmorph
😱 Isomorphic transformations. Map, transform, filter, and morph your objects
Stars: ✭ 26 (+36.84%)
Mutual labels:  mapping

solidity-itMapsLib

Iterable maps library for Ethereum Solidity

NOTE: It's a first pass release, code review is needed and suggestions are welcome!

Overview

Provides new custom, iterable map types for different key / value types:

  • itMapUintUint for uint=>uint maps
  • itMapAddressUint for address=>uint maps
  • itMapUintAddress for uint=>address maps
  • itMapUintBool for uint=>bool maps

Use

Import

import "./itMapsLib.sol"
// Use itMaps for all functions on the struct
using itMaps for itmap.itMapUintUint;
using itMaps for itmap.itMapAddressUint;
using itMaps for itmap.itMapUintAddress;
using itMaps for itmap.itMapUintBool;

Examples

// Example variable declarations
itMaps.itMapUintUint im_myUintUintMap;
itMaps.itMapAddressUint im_myAddressUintMap;
itMaps.itMapUintAddress im_myUintAddressMap;
itMaps.itMapUintBool im_myUintBoolMap;
  • Insert

    im_myUintUintMap.insert( <uint key>, <uint value>);

  • Return item value by item key

    im_myUintUintMap.get(<uint key>);

  • Check if key exists in map - returns true if it does

    im_myUintUintMap.contains(<uint key);

  • Get size of the map

    im_myUintUintMap.size();

  • Get item key by mapping index

    im_myUintUintMap.getKeyByIndex(<uint idx>);

  • Get item value by mapping index

    im_myUintUintMap.getValueByIndex(<uint idx>);

  • Remove an item from map - returns true if item was in map

    im_myUintUintMap.remove(<uint key>);

  • Delete all mapping and array. NOTE: it iterates thourgh on all items.

    im_myUintUintMap.destroy();

  • TODO: deletes all mapping and sets array lenght to 0 (doesn't free up array storage)

    im_myUintUintMap.clear(); // not yet implemented

Storage considerations

TODO: some explanation about ethereum storage considerations/implications

Testing

TODO: write unit tests

Contributing

Pull requests are more than welcome. Code review, optimalisation, storage improvements, new mapping types, structure, unit tests etc.

Authors

Licence

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

WARNING: original gists didn't have any licence. Permission is pending from original authors.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].