Git Product home page Git Product logo

jibrel-contracts's People

Contributors

alekseiselikhov avatar alekseyselikhov avatar iviol avatar mezrin avatar

Stargazers

 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

Forkers

chaincloud

jibrel-contracts's Issues

Create readme file

  • short description
  • links to the website and repo with whitepapers
  • badge coveralls
  • How to test
    • npm test
    • jsapi test
    • coverage test

Configure coveralls

It is worth to configure coveralls for our project. Should be straightforward, we always have scripts for this (copied from zeppelin-solidity repo).

Add coveralls badge to the readme

Add state events

If we will try to create really fast API of a blockexplorer - we will face a problem: in order to read smth from the contract state - we have to call getter of the contract.
I.e. we have to launch Ethereum virtual machine and execute the contract.
It is not possible to cache such data in the blockexplorer.
A possible solution - save state in the events.
For example, when user transfer tokens - we save in the events not only addresses of sender&receiver and transferred amount, but also new balances of each of them.

  • Think about this
  • Estimate gas costs
  • If we agree with this solution - implement

Refactoring of JS code

Logging

  • save data to the file

Tests

  • Switch to jsapi completely

JSAPI

  • create logging decorators
  • chek inputs

Restrict transmission of ETH to our contracts

Transmission of ETH does not make sense for crydr view&storage contracts.
Do we need to declare them and set restrictions for ETH transfers.
For example, we can allow only to crydr controller to send ETH to the contract.
Or even completely prohibit transmission of ETH to the contracts

Add checks for transfer methods

Currently crydrs allow to send 1 tokens
I.e. A can send 0 jUSD to B, and A will be charged in JNT
This does not make sense
Abb check value > 0

Add blocks to the CrydrStorage

It is a very common need for tokens - be able to block transfers of just one account.
We need to add it before crydrs published
I.e.

function blockAccount(address _account) onlyManager('block_accounts') {
    blockedAccounts[_account] += 1;
}
function unblockAccount(address _account) onlyManager('unblock_accounts') {
    blockedAccounts[_account] 1= 1;
}

Also, there is another common need for accounts - block some amount of account:

function blockFunds(address _account, uint _value) onlyManager('block_funds') {
    blockedFunds[_account] += _value;
}

If 500 tokens blocked - balance of account can not go below 500

Assign unique ID to each crydr

When we will have hundreds of Cydrs - we will have a really big risk to mess with view/storage/controller contracts. For example, we can assign controller of CRYDR#1 to the view of CRYDR#2
We need a reliable way to eliminate such risks.

We can do the following:

  • assign the unique ID to each crydr
  • hardcode this id to each view/storage/controller contract
  • check these IDs when the manager tries to unpause contract

Switch to the test suits

There is a mess in our tests
We need to:

  • create a test suite for each contract
  • use test suite for contract and all contract derived from it

Make waitTxConfirmation more fault-tolerant

Sometimes Ethereum node returns undefined for the request.
In this situation, whole migration is failed
need to skip a number of failed requests to the node, and only this fail

Fix launch of tests on osx

> [email protected] test /Users/tonykent/Test/jibrel-contracts
> scripts/test.sh

Starting our own testrpc instance
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
tr: Illegal byte sequence
cat: stdout: Broken pipe
/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:74143
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS

RangeError: private key length is invalid
    at RangeError (native)
    at Object.exports.isBufferLength (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:60654:39)
    at Object.publicKeyCreate (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:60446:14)
    at Object.exports.privateToPublic (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:7065:20)
    at StateManager.createAccount (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:90434:25)
    at Array.map (native)
    at StateManager.initialize (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:90342:33)
    at new GethApiDouble (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:89816:14)
    at new Provider (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:28446:23)
    at Object.create (/Users/tonykent/Test/jibrel-contracts/node_modules/ethereumjs-testrpc/build/cli.node.js:105938:20)
Could not connect to your Ethereum client. Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle.js)
npm ERR! Test failed.  See above for more details.

Add code to execute arbitrary bytecode

We can pass any bytecode to the contract and execute it using contract`s private key
This is will be used for non-ordinary cases.
For example, when someone accidentally sends ERC20 tokens to our contracts and we have to rescue this funds.
It worth to this functionality to crydr views&storages - contracts which we are not able to replace with the newer version

function executeBytecode(address target, uint ethValue, bytes transactionBytecode)  onlyAllowedManager('..') {
         isExecuted = true; // Avoid recursive calling
         require(target.call.value(ethValue)(transactionBytecode));
         isExecuted = false;
         // fire event
    }

Check zeppelin-solidity

Check implementation of a token in zeppelin-solidity library
Copy tests for tokens if we missed something

Same for Pausable contract

Two-step transfer of ownership

We need to implement two-step process:

  • old owner request transfer ownership to the new owner
  • new owner creates tx to actually become an owner

This saves from the wide range of bugs related to migration scripts

Set event params with variable size as not indexed

web3 does not work correctly with the events that have indexed parameters with variable size (strings, arrays etc.).
We should set all such params as not indexed.
I.e.:

event ManagerPermissionGrantedEvent(address indexed manager, string indexed permission); -> event ManagerPermissionGrantedEvent(address indexed manager, string permission);

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.