jibrelnetwork / jibrel-contracts Goto Github PK
View Code? Open in Web Editor NEWEthereum smart contracts to support the on-chain activity of the Jibrel
License: Other
Ethereum smart contracts to support the on-chain activity of the Jibrel
License: Other
Mark all possible functions as external
https://solidity.readthedocs.io/en/latest/contracts.html#visibility-and-getters
Be kind, free blockchain space, remove unused contracts
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
Merge code for coverage tests into the branch dev
Hit the 100% coverage
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.
returns (address varName)
-> returns (address)
Logging
Tests
JSAPI
Fix errors produced by eslint
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
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
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
One crydr - one migration script
It will be difficult (in case of big migration script) to manually revive the system if smth wrong with the migration
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:
Truffle uses names of contracts as unique ID
To avoid mess we have to make versioning using names of contracts
There is a mess in our tests
We need to:
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
CrydrStorageBaseInterface.sol
add events for accouns/funds blocks
Actually, this applies to any method that is not expose directly to the users
> [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.
Lib is finished. Merge tests for this lib into the branch dev
And update to Solidity 0.4.17
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
check names of events params
it is different from zeppelin-solidity
Strings are easier to read, less error prone
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
}
Prohibit to a specific address to receive tokens
We need to eliminate possibility of short address attack
Check implementation of a token in zeppelin-solidity library
Copy tests for tokens if we missed something
Same for Pausable contract
We need to implement two-step process:
This saves from the wide range of bugs related to migration scripts
Evaluation of gas amount used to deploy a contract does not work on the main network
Add tests for crydr controllers
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);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.