What do Rate, Wallet, Token and Token Wallet mean in Crowdsale constructor?

@abcoathup
I was not understand this four Rate, Wallet, Token and Token Wallet can you explain me in simple word. Thanks !!!
If i have a token then what data i need to fill in this four box? and which wallet or contract address buyer need to send ETH to buy my token? Thanks for your support !!!

image

1 Like

Hi @Rahaman,

:warning: If you are creating a crowdsale for production, your solution should be appropriately tested, appropriately audited and you should check regulatory compliance prior to launch.

:warning: If you are using Crowdsale contracts with an ERC777, you need to check for any issues with reentrancy. See: Reentrancy After Istanbul


Rate

The rate is the conversion between wei and the smallest and indivisible token unit. So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK.

See the documentation for details: https://docs.openzeppelin.com/contracts/2.x/crowdsales#crowdsale-rate

Wallet

Is the wallet that you want to receive funds.

In a production system you may want to look at a multi-sig wallet (with signatories being hardware wallets) or a hardware wallet.

For testing you could use an address that you control

Token

This is the address of your token that you are selling in your Crowdsale

TokenWallet

This is the address holding the tokens that are being sold in the AllowanceCrowdsale.
An allowance needs to be approved to the Crowdsale.

1 Like

Thanks !!!

image

  1. This Token address is the Token Contract Address?

  2. Which address Buyers need to send fund to buy the Token?

1 Like

Hi @Rahaman,

Yes

Purchasers would need to call buyTokens function on your crowdsale contract.

Thanks for your help & support. :revolving_hearts:

1 Like

@abcoathup

I was not understand What is the Beneficiary (address): which address is this?

1 Like

Hi @Rahaman,

beneficiary is the address where a purchaser calling buyTokens wants the tokens delivered.

1 Like

@abcoathup
Can you try to interact with My contract and test as a buyer, so i can understand it better.

AllowanceCrowdsale Contract Address: 0x8c66b79ed8351d60ab8656f15f9956dd23796204

ABI Code

[{"inputs":[{"internalType": "uint256","name": "rate","type": "uint256"},{"internalType": "address payable","name": "wallet","type": "address"},{"internalType": "contract IERC20",	"name": "token","type": "address"},{"internalType": "address","name": "tokenWallet","type": "address"}],"payable": false,"stateMutability": "nonpayable","type": "constructor"},{"anonymous": false,"inputs": [{"indexed": true,"internalType": "address","name": "purchaser","type": "address"},{"indexed": true,"internalType": "address","name": "beneficiary","type": "address"},{"indexed": false,"internalType": "uint256","name": "value","type": "uint256"},{"indexed": false,"internalType": "uint256","name": "amount","type": "uint256"}],"name": "TokensPurchased","type": "event"},{"payable": true,"stateMutability": "payable","type": "fallback"},{"constant": false,"inputs": [{"internalType": "address","name": "beneficiary","type": "address"}],"name": "buyTokens","outputs": [],"payable": true,"stateMutability": "payable","type": "function"},{"constant": true,"inputs": [],"name": "rate","outputs": [{"internalType": "uint256","name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"},{"constant": true,"inputs": [],"name": "remainingTokens","outputs": [{"internalType": "uint256","name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"},{"constant": true,"inputs": [],"name": "token","outputs": [{"internalType": "contract IERC20","name": "","type": "address"}],"payable": false,"stateMutability": "view","type": "function"},{"constant": true,"inputs": [],"name": "tokenWallet","outputs": [{"internalType": "address","name": "","type": "address"}],"payable": false,"stateMutability": "view","type": "function"},{"constant": true,"inputs": [],"name": "wallet","outputs": [{"internalType": "address payable","name": "","type": "address"}],"payable": false,"stateMutability": "view","type": "function"},{"constant": true,"inputs": [],"name": "weiRaised","outputs": [{"internalType": "uint256","name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"}]
1 Like

Hi @Rahaman,

I used https://oneclickdapp.com/ to interact with your crowdsale.

I tried calling buyTokens with 0.1 Ether and the transaction failed:

I called buyTokens with 1 wei and the transaction succeeded:

Your rate is currently: 1000000000000000000000

I suggest reading through the documentation on Rates: https://docs.openzeppelin.com/contracts/2.x/crowdsales#crowdsale-rate
Also the documentation on decimals:
https://docs.openzeppelin.com/contracts/2.x/erc20#a-note-on-decimals

1 Like

@abcoathup
Thanks now I understand the rate, how i need to sat.

1 Like