This is Ethereum cryptocurrency contracts based on ERC20 Token Standard.
To make the contract upgradable we separate Logic and Storage like here. It splits the contract into Procoin and ProcoinDB. To run them all you need:
- deploy ProcoinDB;
- deploy Procoin using ProcionDB address;
- add Procoin to ProcoinDB owners;
See tests for example.
We use Truffle framework for developing and testing.
npm install -g truffle
Run tests:
truffle test
Setup temp blockchain and run console attached to it:
truffle development
Then run migrate command to create all smart contracts:
migrate
And finally you need to add Procoin to ProcoinDB owners.
ProcoinDB.at(<db address>).changeOwner(<procoin address>, true)
You can start using the contract from adding tokens to a user:
Procoin.at(<procoin address>).mintToken(<account address>, 10e+6)
Another option is to setup Ganache App and connect to it:
truffle console --network ganache
Also it's possible to connect to any network. See truffle docs for details.
Ropsten is one of the live test blockchain. You need an account with some ether and RPC Server url (check Infura). To deploy from scratch:
DEPLOYMENT_PRIVATE_KEY=<private key> ETHEREUM_RPC_URL=<rpc server url> truffle migrate --network ropsten
It uses Truffle HD Wallet Provider internally.
First of all the token contract has all ERC20 Standard functions like tranfer, allow, transferFrom. See ERC20
Adding of new tokens to any account.
Blacklist of accounts who is restricted to transfer tokens.
Every transaction (tranfer) costs ether. But as a token holder I don't want to have two currencies (tokens and ether) to send Procoin. There is an Improvement Proposal 865 to overcome this and one of the possible solution.
So every token holder can sign transfer params with his private key and save somewhere. And anybody who has ether is able to execute this signed transaction.
Sign process is implemented on the frontend side. See Procoin Client