EUR is an ERC-20 stablecoin - Smart contract of digital EUR on Ethereum Blockchain
The EURC smart contract used OpenZeppelin which is library for secure smart contract development.
The guides in the OpenZeppelin docs site will teach how to deploy and interaction to smart contract.
- Make sure you have node v12.8.3 or higher, check it with
node --version
- Install packages
npm install
-
Download, install and open Ganache
-
Compile solidity with truffle
npx truffle compile
- Deploy smart contracts to your localhost Ethereum Ganache
npx truffle migrate --network development
result of your deployment:
Starting migrations...
======================
> Network name: 'development'
> Network id: 5777
> Block gas limit: 6721975 (0x6691b7)
1_initial_migration.js
======================
Replacing 'Migrations'
----------------------
> transaction hash: 0x22f3d8f6b36baa7d55484e497119ae494c226b2ac0868ff8f149cf46c613035f
> Blocks: 0 Seconds: 0
> contract address: 0x0569F5E69aaD81a62d91D927995621EF13AA2d7F
> block number: 1
> block timestamp: 1611340650
> account: 0x7904bF7aC4EdC845b2057d2F44A1D19e33468ce5
> balance: 99.99626074
> gas used: 186963 (0x2da53)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.00373926 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.00373926 ETH
2_deploy_contracts.js
=====================
Replacing 'Euro'
----------------
> transaction hash: 0x6df413a4b34331bc5ab4f4366ad57dcbc60fcfb1da2c72e94c79cb9e8bc4e9a6
> Blocks: 0 Seconds: 0
> contract address: 0x6E01BF5B1003833DFB4D6237821FD49a48b1446D
> block number: 3
> block timestamp: 1611340650
> account: 0x7904bF7aC4EdC845b2057d2F44A1D19e33468ce5
> balance: 99.95791582
> gas used: 1874911 (0x1c9bdf)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.03749822 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.03749822 ETH
Summary
=======
> Total deployments: 2
> Final cost: 0.04123748 ETH
$ npx truffle console --network development
truffle(development)> Euro = await Euro.deployed()
undefined
Use Owner adres for examample:0x7904bF7aC4EdC845b2057d2F44A1D19e33468ce5 Minting 500 Euro coins: We are using 6 decimals which means 500000000 to mint
$ truffle(development)> await Euro.mint("0x7904bF7aC4EdC845b2057d2F44A1D19e33468ce5", 500000000)
See also OpenZeppelin documentation transfer(address recipient, uint256 amount)
User adress example: 0xd7ab3436414E7412c004811ec960c908d34704ef
$ truffle(development)> await Euro.transfer("0xd7ab3436414E7412c004811ec960c908d34704ef", 500000000)
See also this medium blog
Make sure you change your network to Ganache Development in Metamask and read this blog
Running unit test
npm run test
Running test coverage
npm run coverage
Lint solidity
npm run lint:sol
see also Connecting to public test networks
To send transactions in a testnet, you will need a new Ethereum account using mnemonics package
npx mnemonics
drama film snack motion ...
cp secrets.json.example secrets.json
Copy your mnemonics words to secret.json
https://www.alchemyapi.io/ Copy your API KEY to secret.json
Using Rinkeby Authenticated Faucet or using MetaMask’s faucet
npx truffle migrate --network rinkeby
If you find a security issue, please join our Discord
- Ask for help and follow progress at: Discord
Interested in contributing to EURC?
- Issue tracker: issues
- Contribution guidelines: contributing
Code released under the MIT License.