This repository represents a fungible token that is ERC-20 compliant and that will be minted by using a Crowdsale contract from the OpenZeppelin Solidity library. The contract allows user manage the entire crowdsale process, allowing users to send ether to the contract and in return receive KaseiCoin tokens. Contract mints the tokens automatically and distributes them to buyers in one transaction.
This project leverages the following tools for financial analysis:
-
Solidity - programming language for implementing smart contracts.
-
Remix IDE - Remix IDE allows developing, deploying and administering smart contracts for Ethereum like blockchains.
-
TruffleSuite - Ganache - a personal Ethereum blockchain.
Solidity version:
pragma solidity ^0.5.0
OpenZeppelin libraries:
CrowdSale:
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/Crowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/emission/MintedCrowdsale.sol";
ERC20 token:
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Detailed.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Mintable.sol";
Pls, download and install Ganache
from https://trufflesuite.com/ganache/
Pls, download and install wallet Metamask from https://metamask.io
Configure the Metamask:
- copy
private
account keys from Ganache and import them to create the Accounts
- configure network like on the screenshot
Inject the testing account from the Ganache:
Confirm injection:
- compile smart contracts:
KaseiCoin:
KaseiCoinCrowdsale and KaseiCoinCrowdsaleDeployer:
Deploy Deployer
Pls, select and provide:
-
deployer contract;
-
NAME of Coin (Kasei);
-
SYMBOL of Coin (KAS);
-
WALLET (any valid address).
Click on Transact
and confirm transaction in the Metamask
Check transaction in the Ganache:
Account balance:
First use functions under CrowdSaleDeployer for taking contract's addresses:
CrowdSale
contract
KaseiCoin
contract
Second put addresses to At address
field for linking contracts:
Finally contracts and their functions are got available for testing:
and
Try to buy tokens. Input value and address:
In my case Value is 5 Ethers
.
Confirm with Metamask:
Check transaction in the Ganache:
and with function balanceOf
check balance associated with testing account(s)
View the total supply of minted tokens:
View the amount of wei that has been raised in the crowdsale contract:
Glupak Vladislav Linkedin