【发布时间】:2019-04-17 22:19:44
【问题描述】:
所以我有一份合同,允许您用 ETH 交换我的自定义 ERC20 代币。我现在想将该自定义 ERC20 代币与其他智能合约一起使用。是否有某种方式我必须指定自定义令牌与 ETH?
示例:
pragma solidity ^0.4.24;
/* * - -如何使用: * 1. 向智能合约地址发送任意数量的 HYPER Token。 * 2. 通过发送 0 HYPER 交易(每小时 1 次)来获取您的利润 * 3. 如果您不提款且收入超过200%,您只能提款超过200%的限额一次 */ 合约 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);
}
我不想返还 ETH,而是想使用我的自定义 ERC20 代币给用户发送到合约并获得 ERC20 代币的百分比作为回报。
【问题讨论】:
标签: solidity smartcontracts erc20