Hi all,
I make a simple contract and play with it on the testnet, I create a token (JDR) and a smart contract, i send my token on smart contract, i set a start and an end to the contract, when it ends I have JDR tokens lefts on the smart contract, how can I withdraw all the remaining tokens on the smart contract?
and how people can get their tokens automatically ? because when the contract end, they have to withdraw manually their tokens.
Code to reproduce
Smart contract
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/Crowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/distribution/FinalizableCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract SimpleCrowdsale is Crowdsale, TimedCrowdsale, FinalizableCrowdsale, PostDeliveryCrowdsale {
constructor (
uint256 rate,
address payable wallet,
IERC20 token,
uint openingTime,
uint closingTime
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
FinalizableCrowdsale()
{
}
}
Token contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract SimpleTokens ERC20 {
constructor() ERC20("SimpleToken", "JDR") {
_mint(msg.sender, 10000000000 * 10 ** decimals());
}
}
Environment
I use Remix for all the deployement.
Thanks for the answers !