Hi everyone,
I am working on a crowdsale project for my first freelance client.
The budget is very small(Im trying to build a portfolio) so I cannot do mistakes due to deployment fees.
I have those two contracts:
Sales contract:
pragma solidity ^0.5.0;
import "./Crowdcoin.sol";
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";
// @TODO: Inherit the crowdsale contracts
contract CrowdcoinSale is Crowdsale, MintedCrowdsale {
constructor(
// @TODO: Fill in the constructor parameters!
uint rate, // rate in TKNbits
address payable wallet, // sale beneficiary
Crowdcoin token, // the Crowdcoin itself that the CrowdcoinSale will work with
)
// @TODO: Pass the constructor parameters to the crowdsale contracts.
Crowdsale(rate, wallet, token)
MintedCrowdsale()
public
{
// constructor can stay empty
}
}
contract CrowdcoinSaleDeployer {
address public token_sale_address;
address public token_address;
constructor(
// @TODO: Fill in the constructor parameters!
string memory name,
string memory symbol,
address payable wallet // this address will receive all Ether raised by the sale
)
public
{
// @TODO: create the Crowdcoin and keep its address handy
Crowdcoin token = new Crowdcoin(name, symbol, 0);
token_address = address(token);
// @TODO: create the CrowdcoinSale and tell it about the token, set the goal, and set the open and close times to now and now + 24 weeks.
uint goal = 300 wei;
uint cap = 300 wei;
CrowdcoinSale Crowdcoin_sale = new CrowdcoinSale(1, wallet, token, goal, cap, now, now + 24 weeks);
token_sale_address = address(Crowdcoin_sale);
// make the CrowdcoinSale contract a minter, then have the CrowdcoinSaleDeployer renounce its minter role
token.addMinter(token_sale_address);
token.renounceMinter();
}
}
``
Presale Token contract:
``
pragma solidity ^0.5.0;
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";
contract crowdcoin is ERC20, ERC20Detailed, ERC20Mintable {
constructor(
string memory name,
string memory symbol,
uint initial_supply
)
ERC20Detailed(name, symbol, 18)
public
{
mint(msg.sender, initial_supply);
}
}
I plan to proceed like this:
1- Paste the crowdsale contract on remix.ethereum.org in the crowdsale.sol file that I will deploy with bsc
2- Paste the token on remix.ethereum.org in the crowdcoin.sol file that I will deploy with bsc
For the prior two steps, will they automatically work together?
how do I link it on my client’s website so the participants can connect their bnb wallets swap directly from the sale webpage?
Thank You in advance !