Giter Site home page Giter Site logo

hq20 / contracts Goto Github PK

View Code? Open in Web Editor NEW
458.0 20.0 108.0 4.34 MB

A set of reusable smart-contracts

Home Page: https://hq20-contracts.netlify.com/

License: Apache License 2.0

JavaScript 1.64% Solidity 35.95% Shell 0.72% TypeScript 61.68%
solidity truffle techhq reusable smart-contracts package

contracts's People

Contributors

alcueca avatar dependabot-preview[bot] avatar obernardovieira avatar uivlis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contracts's Issues

Voting and Staking

Consider how a voting library could be built for DAO.sol.

The idea is that there are several actions that can be voted. The actions are known at coding time (for example, investing in a new venture, distributing dividends and raising funds).

Voting is the same for all actions. There is a staking token and each token is one vote. Each token cannot be used for more than one voting simultaneously.

I would like the logic to be reused between voting actions, only changing the resulting action if the vote is successful.

We might have to mess with function signatures and things like that, no idea really.

Example of RBAC.sol usage

This could be something like an ERC20 factory, where the ERC20s created get the RBAC.sol contract and user defined roles for minters and recipients.

It might need a bit of a frontend to make sense.

Escrow Example

OpenZeppelin has Escrow contracts, but I see no examples. I like examples. Maybe even a simple use case.

Use fixed point math in Issuance.sol

There is an issue with the current formula for token issuance, which is

amount(issuanceToken) = amount(currencyToken)/issuePrice

because you cannot set a subunitary issuePrice. It should be:

amount(issuanceToken) = amount(currencyToken).fixedDiv(issuePrice, 10**18)

or something similar using fixed point math. See ABDK or Fixidity.

ERC1820 Example

The latest evolution of ERC165, in that it includes a global registry of contracts and the interfaces they implement. A bit mind-bending. Obviously needs an example.

Silence warnings for ClassifiedsAdvanced.sol

,/home/alberto/Code/hq20-contracts/contracts/drafts/classifieds/ClassifiedsAdvanced.sol:35:9: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
        address operator,
        ^--------------^

Create classifieds market

Start by using a fixed price buy/sell market as for AB. Please write it from scratch instead of reusing their contract and name everything as for a craigslist classifieds board.

The mechanics are:

  1. The market works with a currency token, like Issuance.sol.
  2. Someone puts a buy or sell advert. There is no description or anything for the advert, just an address as a payload.
  3. The payload address conforms for an ERC721 contract interface.
  4. The buy part puts in escrow an amount of the currency token, for the sell part the ownership of the ERC721 payload is what is put in escrow.

ERC1404 Example

I think this is the earliest try for a security token. There are more recent ones. It would be nice to show we know how to implement things with them.

Add method for Owner to withdraw contract funds

This is a method for the owner to retrieve the currency stored in the issuance contract. Please come up with a suitable name.

It should be possible only on "LIVE" state.

Please merge #26 first and make this issue a PR of its own.

Comment out gas tests

Either comment out the gas tests for LinkedList and friends, or move them somewhere where they don't run with yarn test.

Release Classifieds.sol

  • Rename Classifieds.sol as ClassifiedsAdvanced.sol.

  • Rename ClassifiedsV2.sol as Classifieds.sol and get it out of drafts.

  • Increase test coverage of the Classifieds.sol outside drafts until tests pass (90%?)

Link repo and soldoc

When opening the soldoc page there is no link to go to the repo. When opening the repo in github there is no link to go to the soldoc page.

Create Whitelist contract inside access

Branch new/whitelist

This is a stripped down version of RBAC.sol, with just one Role.

An Ownable contract that keeps a mapping of address => bool

Methods:
isMember: returns mapping(address)
addMember: sets mapping(address) = true
removeMember: delete mapping(address)

There is no listing of members, that will be done in a separate issue and contract.

ERC777 example

ERC777 is supposed to supersede ERC20. OpenZeppelin has an implementation. I would like to have an example of how to use it.

Parallel tests?

Our tests are getting longer to run as the package grows. Would it be a good idea to parallelize them?

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.