Address Contract Verified
Address
0x79dC7BBFD0c9088B0633556D292B24c6F2dAe33c
Balance
0 ETH
Nonce
1
Code Size
2671 bytes
Creator
0xf71708C5...bf0c at tx 0x1cae919d...15d45c
Indexed Transactions
0
Contract Bytecode
2671 bytes
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063a98ad46c11610071578063a98ad46c14610166578063c3443b691461016e578063caa32b9114610176578063ce5f9454146101b4578063f895be10146101bc578063fb301841146101d9576100a9565b8063824df88d146100ae57806382543b32146100de5780638da5cb5b146100f857806393d8685f1461011c57806396ce07951461015e575b600080fd5b6100dc600480360360408110156100c457600080fd5b506001600160a01b03813516906020013515156101f7565b005b6100e661026b565b60408051918252519081900360200190f35b610100610271565b604080516001600160a01b039092168252519081900360200190f35b6100dc600480360360a081101561013257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135610280565b6100e661035b565b610100610361565b610100610370565b6100dc600480360360a081101561018c57600080fd5b508035906001600160a01b03602082013516906040810135906060810135906080013561037f565b6100e6610536565b6100e6600480360360208110156101d257600080fd5b503561053c565b6101e1610595565b6040805160ff9092168252519081900360200190f35b6006546001600160a01b031633146102405760405162461bcd60e51b815260040180806020018281038252602f8152602001806109c1602f913960400191505060405180910390fd5b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b60025481565b6006546001600160a01b031681565b6006546001600160a01b031633146102c95760405162461bcd60e51b815260040180806020018281038252602f8152602001806109c1602f913960400191505060405180910390fd5b60045461031d576040805162461bcd60e51b815260206004820152601860248201527f64656e6f6d696e61746f722063616e206e6f7420626520300000000000000000604482015290519081900360640190fd5b600080546001600160a01b039687166001600160a01b0319918216179091556001805495909616941693909317909355600255600391909155600455565b60045481565b6001546001600160a01b031681565b6000546001600160a01b031681565b3360009081526005602052604090205460ff1615156001146103d25760405162461bcd60e51b815260040180806020018281038252602c815260200180610995602c913960400191505060405180910390fd5b60008054604080516323b872dd60e01b81523360048201523060248201526044810189905290516001600160a01b03909216926323b872dd926064808401936020939083900390910190829087803b15801561042d57600080fd5b505af1158015610441573d6000803e3d6000fd5b505050506040513d602081101561045757600080fd5b50600090506104658661053c565b600154909150610486906001600160a01b031686308463ffffffff6105a516565b6006546001546104a9916001600160a01b0391821691168363ffffffff61060516565b600080546040805163a9059cbb60e01b81526001600160a01b038981166004830152602482018b90529151919092169263a9059cbb92604480820193602093909283900390910190829087803b15801561050257600080fd5b505af1158015610516573d6000803e3d6000fd5b505050506040513d602081101561052c57600080fd5b5050505050505050565b60035481565b600061058f61056f600254600060149054906101000a900460ff1660ff1603600a0a60045461065c90919063ffffffff16565b60035461058390859063ffffffff61065c16565b9063ffffffff6106bc16565b92915050565b600054600160a01b900460ff1681565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526105ff9085906106fe565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106579084906106fe565b505050565b60008261066b5750600061058f565b8282028284828161067857fe5b04146106b55760405162461bcd60e51b81526004018080602001828103825260218152602001806109f06021913960400191505060405180910390fd5b9392505050565b60006106b583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506108b6565b610710826001600160a01b0316610958565b610761576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061079f5780518252601f199092019160209182019101610780565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610801576040519150601f19603f3d011682016040523d82523d6000602084013e610806565b606091505b50915091508161085d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156105ff5780806020019051602081101561087957600080fd5b50516105ff5760405162461bcd60e51b815260040180806020018281038252602a815260200180610a11602a913960400191505060405180910390fd5b600081836109425760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109075781810151838201526020016108ef565b50505050905090810190601f1680156109345780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161094e57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061098c5750808214155b94935050505056fe63616c6c657220686173206e6f207065726d697373696f6e20746f2063616c6c20636f757274416d6f756e746f6e6c79206f776e65722063616e206368616e6765204e756d657261746f7220616e642044656e6f6d696e61746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820e262153e685e7419b77132c5e64d8e8c00b19bc895857dc52e16d0e00937007064736f6c63430005110032
Verified Source Code Full Match
Compiler: v0.5.17+commit.d19bba13
EVM: istanbul
Optimization: Yes (200 runs)
HT_Claim.sol 265 lines
/**
*Submitted for verification at Etherscan.io on 2021-05-12
*/
pragma solidity ^0.5.0;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to assume that an address for which this
* function returns false is an externally-owned account (EOA) and not a
* contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface ICourtStake{
function lockedStake(uint256 amount, address beneficiar, uint256 StartReleasingTime, uint256 batchCount, uint256 batchPeriod) external;
}
contract HT_Claim is ICourtStake{
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public courtToken = IERC20(0x0538A9b4f4dcB0CB01A7fA34e17C0AC947c22553);
uint8 public courtDecimals = 18;
IERC20 public usdtToken = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);
uint256 public usdtDecimals = 6;
uint256 public numerator = 100;
uint256 public denominator = 1; // usdt is 6 decimals so 1 usdt = 1e12 other
mapping(address => bool) hasPermissionToCallLockedStake;
address public owner;
constructor() public{
owner = msg.sender ;
}
function changeParameters(address courtAddress, address usdtAddress, uint256 decimals,uint256 _numerator, uint256 _denominator) public{
require(msg.sender == owner, "only owner can change Numerator and Denominator");
require(denominator != 0, "denominator can not be 0"); //can not div by zero
courtToken = IERC20(courtAddress);
usdtToken = IERC20(usdtAddress);
usdtDecimals = decimals;
numerator = _numerator;
denominator = _denominator;
}
function lockedStake(uint256 courtAmount, address beneficiar, uint256, uint256, uint256) public{
require(hasPermissionToCallLockedStake[msg.sender] == true, "caller has no permission to call courtAmount");
courtToken.transferFrom(msg.sender,address(this), courtAmount); // msg sender here is the HTStake contracte
uint256 usdtAmount = getRequiredAmount(courtAmount);
usdtToken.safeTransferFrom(beneficiar,address(this),usdtAmount); // user need to approve this contract
usdtToken.safeTransfer(owner,usdtAmount);
courtToken.transfer(beneficiar,courtAmount); //beneficiar the one who claim court
}
function getRequiredAmount(uint256 amount) public view returns(uint256){
return amount.mul(numerator).div(denominator.mul(10 ** (courtDecimals - usdtDecimals) ));
}
function setLockedStakePermission(address account, bool permissionFlag) public{
require(msg.sender == owner, "only owner can change Numerator and Denominator");
hasPermissionToCallLockedStake[account] = permissionFlag;
}
}
Read Contract
courtDecimals 0xfb301841 → uint8
courtToken 0xc3443b69 → address
denominator 0x96ce0795 → uint256
getRequiredAmount 0xf895be10 → uint256
numerator 0xce5f9454 → uint256
owner 0x8da5cb5b → address
usdtDecimals 0x82543b32 → uint256
usdtToken 0xa98ad46c → address
Write Contract 3 functions
These functions modify contract state and require a wallet transaction to execute.
changeParameters 0x93d8685f
address courtAddress
address usdtAddress
uint256 decimals
uint256 _numerator
uint256 _denominator
lockedStake 0xcaa32b91
uint256 courtAmount
address beneficiar
uint256
uint256
uint256
setLockedStakePermission 0x824df88d
address account
bool permissionFlag
Recent Transactions
No transactions found for this address