Tomy_R
March 2, 2021, 9:18am
1
In October 2020, I used a free token generator https://vittominacori.github.io/erc20-generator/
Back then there were no paid plans like now so that token was simple, easy token with few customization like decimals, max supply, symbol, name. Without Mintable option.
It is possible to use the generated token, then transfer part of this tokens to the simple ICO contract and sell it to others?
Most of the example uses and tutorials describe how to generate a token and create an ICO with it. But how to use an already existing token and transfer part of it to an ICO contract? Is it possible?
1 Like
Hi @Tomy_R ,
Welcome to the community
Assuming you have a fixed supply ERC20 token, then you could transfer any number of tokens to a crowdsale contract (or list on a decentralized exchange).
See the Simple ERC20 Crowdsale .
I also recommend going through Points to consider when creating a fungible token (ERC20, ERC777) .
Tomy_R
March 7, 2021, 4:34pm
3
I still don’t understand.
Ok for example:
I created 1000 test tokens.
Token1test (TKN1) Token Tracker on Etherscan shows the price of the Token $0.0000, total supply 1,000, number of holders 1 and updated information of the token. The token tracker page also shows the analytics and historical data.
I want to sell half of them for Ether.
So:
Which contract I have to use in Remix? Can You show me a simple example
ie. 10 test tokens for 1 Ether
Then I have to deploy this cotract to the testnet, rigt?
I have to transfer 500 tokens manualy to this contract or what I have to do?
If I send 1 ether to this contract I will receive 10 test tokens, right?
Please explain.
Thank You very much!
1 Like
Skyge
March 8, 2021, 1:33am
4
Just like abcoathup
mentioned above, I think what you need are all there.
You should use the crowdsale
contract,
SimpleCrowdsale.sol
// contracts/SimpleCrowdsale.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.5;
import "@openzeppelin/contracts/crowdsale/Crowdsale.sol";
/**
* @title SimpleCrowdsale
* @dev This is an example of a fully fledged crowdsale.
*/
contract SimpleCrowdsale is Crowdsale {
constructor(
uint256 rate,
address payable wallet,
IERC20 token
) public Crowdsale(rate, wallet, token) {}
}
Yes!
Right!
Tomy_R:
If I send 1 ether to this contract I will receive 10 test tokens, right?
Depends on the rate
you set.
1 Like
Tomy_R
March 8, 2021, 8:02am
5
should I enter these values in SimpleCrowdsale.sol
or in a different file?
Can you correct it because it shows me the error, please?
1 Like
Skyge
March 8, 2021, 10:25am
6
If you want to test by the Remix, you should use the following way to import the dependency:
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/Crowdsale.sol";
And it seems like you have trouble using Remix to test, you can have a look at this tutorial:
Create an ERC20 using Remix, without writing Solidity - General / Guides and Tutorials - OpenZeppelin Community
1 Like
Tomy_R
March 8, 2021, 1:33pm
7
I tested SimpleToken.sol and it’s working
but SimpleCrowdsale.sol not working
i have two errors
browser/SimpleCrowdsale.sol:13:23: ParserError: Expected type name uint256 rate, 10 ^^
and
creation of SimpleCrowdsale errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.0.8)
1 Like
Skyge
March 8, 2021, 1:56pm
8
You should set these values when deploy rather than set in the code.
2 Likes
Tomy_R
March 9, 2021, 12:04pm
10
Tomy_R:
thank You very much! This solution resolves all my problems.
I love You mate
thank You very much! This solution resolves all my problems.
I love You mate
1 Like