So I have a contract that allows you to exchange ETH for my custom ERC20 token. I am wanting to use that custom ERC20 token now with other smart contracts. Is there a certain way I have to specify the custom token vs ETH?
example:
pragma solidity ^0.4.24;
/* * ---How to use: * 1. Send HYPER Tokens to the smart contract address in any amount. * 2. Claim your profit by sending 0 HYPER transaction (1 time per hour) * 3. If you do not withdraw and earn more than 200%, you can withdraw only one time over the 200% allowance */ contract HyperLENDtest {
using SafeMath for uint;
mapping(address => uint) public balance;
mapping(address => uint) public time;
mapping(address => uint) public percentWithdraw;
mapping(address => uint) public allPercentWithdraw;
function percentRate() public view returns(uint) { uint contractBalance = address(this).balance;
if (contractBalance < 100 ether) {
return (20);
}
if (contractBalance >= 500 ether && contractBalance < 1000 ether) {
return (40);
}
if (contractBalance >= 1000 ether && contractBalance < 2000 ether) {
return (60);
}
if (contractBalance >= 2000 ether) {
return (80);
}
Instead of returning ETH I want to use my custom ERC20 token to users to send to the contract and get in return % of the ERC20 token back.