Smart Contracts to build your ICO solution and issue your ERC20 Token.
Install truffle.
npm install -g truffle // Version 4.1.14+ required.
Create your Smart Contracts folder and init truffle
mkdir MyICO
cd MyICO
truffle init
npm install ico-maker
BaseToken is an ERC20 token with a lot of stuffs like Capped, Mintable, Burnable and ERC1363 Payable Token behaviours.
pragma solidity ^0.4.24;
import "ico-maker/contracts/token/BaseToken.sol";
contract MyToken is BaseToken {
constructor(
string _name,
string _symbol,
uint8 _decimals,
uint256 _cap
)
BaseToken(_name, _symbol, _decimals, _cap)
public
{}
}
Contributions is an utility Smart Contract where to store additional data about crowdsale like the wei contributed or the token balance of each address.
pragma solidity ^0.4.24;
import "ico-maker/contracts/crowdsale/utils/Contributions.sol";
contract MyContributions is Contributions {}
BaseCrowdsale is an extensible Crowdsale contract with Timed and Capped behaviours.
pragma solidity ^0.4.24;
import "ico-maker/contracts/crowdsale/BaseCrowdsale.sol";
contract MyCrowdsale is BaseCrowdsale {
constructor(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
uint256 _cap,
uint256 _minimumContribution,
address _token,
address _contributions
)
BaseCrowdsale(
_openingTime,
_closingTime,
_rate,
_wallet,
_cap,
_minimumContribution,
_token,
_contributions
)
public
{}
}
Bounty is a Capped Smart Contract to mint and distribute tokens for bounty programs.
pragma solidity ^0.4.24;
import "ico-maker/contracts/distribution/Bounty.sol";
contract MyBounty is Bounty {
constructor(address _token, uint256 _cap)
Bounty(_token, _cap)
public
{}
}
Airdrop is a Smart Contract to distribute tokens for airdrop.
pragma solidity ^0.4.24;
import "ico-maker/contracts/distribution/Airdrop.sol";
contract MyAirdrop is Airdrop {
constructor(address _token, address _wallet)
Airdrop(_token, _wallet)
public
{}
}
Install truffle.
npm install -g truffle // Version 4.1.14+ required.
npm install
Use Solium
npm run lint:sol
Use ESLint
npm run lint:js
Use both and fix
npm run lint:fix
Open the Truffle console
truffle develop
Compile
compile
Test
test
Install the truffle-flattener
npm install -g truffle-flattener
Usage
truffle-flattener contracts/token/BaseToken.sol >> dist/BaseToken.dist.sol
Code released under the MIT License.