I am trying to develop forsage like MLM using ethereum smart contract. But I like to use ERC20 token for registration payment and dividends. The ERC20 token is already deployed. I have to use deployed ERC20 token in MLM smart contract for registration payment and dividends. If we are using ether instead of token, we can use payable
for registration payment and address.transfer
method for sending dividends. How to do the same for ERC20.
For example in case of ether, the registration payment will be like,
function registration(address referrerAddress) private {
require(msg.value == 0.05 ether, "registration cost 0.05");
}
Suppose I am expecting 5 token
as registration fee, how to write this logic.
We can send ether to receiver like,
receiverAddress.send(levelPrice)
How to do the same in case of ERC20 token.