Address Contract Partially Verified
Address
0x3b5d2B254224954547A33CbF753BcaA5eB4B27bd
Balance
0 ETH
Nonce
1
Code Size
4899 bytes
Creator
0x3482549f...dcC1 at tx 0x57709267...f29862
Indexed Transactions
0
Contract Bytecode
4899 bytes
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80639ec9b36b116100665780639ec9b36b146100e8578063a3e67610146100fb578063c884ef8314610103578063f2fde38b14610123578063fc0c546a1461013657610093565b80630be42fcc14610098578063715018a6146100ad5780638da5cb5b146100b55780638f32d59b146100d3575b600080fd5b6100ab6100a6366004610d95565b61014b565b005b6100ab610257565b6100bd6102c5565b6040516100ca91906110c9565b60405180910390f35b6100db6102d4565b6040516100ca9190611110565b6100ab6100f6366004610dca565b6102f8565b6100bd610596565b610116610111366004610d77565b6105a5565b6040516100ca91906111db565b6100ab610131366004610d77565b6105b7565b61013e6105e7565b6040516100ca919061115c565b6101536102d4565b6101785760405162461bcd60e51b815260040161016f906111ab565b60405180910390fd5b60005b81518110156102535781818151811061019057fe5b602002602001015160200151600360008484815181106101ac57fe5b6020026020010151600001516001600160a01b03166001600160a01b03168152602001908152602001600020819055508181815181106101e857fe5b6020026020010151600001516001600160a01b03167f4fccb55fc57298c6ed3fb8da8e64b2541fe5ef1a07553abb5123c87d2361ccba83838151811061022a57fe5b60200260200101516020015160405161024391906111db565b60405180910390a260010161017b565b5050565b61025f6102d4565b61027b5760405162461bcd60e51b815260040161016f906111ab565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080546001600160a01b03166102e96105f6565b6001600160a01b031614905090565b6103006102c5565b6001600160a01b0316610326848484610318896105fa565b92919063ffffffff61063316565b6001600160a01b03161461034c5760405162461bcd60e51b815260040161016f906111bb565b60005b845181101561057757600085828151811061036657fe5b6020026020010151600001519050806001600160a01b0316336001600160a01b0316141561056e576001600160a01b03811660009081526003602052604081205487516103d491908990869081106103ba57fe5b60200260200101516020015161071190919063ffffffff16565b9050600081116103f65760405162461bcd60e51b815260040161016f9061119b565b86838151811061040257fe5b6020908102919091018101518101516001600160a01b03808516600090815260039093526040928390209190915560015460025492516323b872dd60e01b8152908216926323b872dd9261045f92911690339086906004016110d7565b602060405180830381600087803b15801561047957600080fd5b505af115801561048d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104b19190810190610e42565b6104cd5760405162461bcd60e51b815260040161016f906111cb565b816001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d48260405161050691906111db565b60405180910390a2816001600160a01b03167f4fccb55fc57298c6ed3fb8da8e64b2541fe5ef1a07553abb5123c87d2361ccba88858151811061054557fe5b60200260200101516020015160405161055e91906111db565b60405180910390a2505050610590565b5060010161034f565b5060405162461bcd60e51b815260040161016f9061118b565b50505050565b6002546001600160a01b031681565b60036020526000908152604090205481565b6105bf6102d4565b6105db5760405162461bcd60e51b815260040161016f906111ab565b6105e48161075c565b50565b6001546001600160a01b031681565b3390565b606061062b8260405160200161061091906110ff565b604051602081830303815290604052805190602001206107dd565b90505b919050565b6000606085905060606106ac6040518060400160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a00000000000081525061067f84516108f0565b604080516000808252602082018181528284018281526060840192835260808401909452889390916109b1565b905060018180519060200120878787604051600081526020016040526040516106d8949392919061111e565b6020604051602081039080840390855afa1580156106fa573d6000803e3d6000fd5b50505060206040510351925050505b949350505050565b600061075383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c57565b90505b92915050565b6001600160a01b0381166107825760405162461bcd60e51b815260040161016f9061117b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082018252601081526f181899199a1a9b1b9c1cb0b131b232b360811b60208201528151828152606081810184529283919060208201818038833901905050905060005b60208110156108e85782600486836020811061083d57fe5b1a60f81b6001600160f81b031916901c60f81c60ff168151811061085d57fe5b602001015160f81c60f81b82826002028151811061087757fe5b60200101906001600160f81b031916908160001a9053508285826020811061089b57fe5b825191901a600f169081106108ac57fe5b602001015160f81c60f81b8282600202600101815181106108c957fe5b60200101906001600160f81b031916908160001a905350600101610825565b509392505050565b60608161091557506040805180820190915260018152600360fc1b602082015261062e565b8160005b811561092d57600101600a82049150610919565b6060816040519080825280601f01601f19166020018201604052801561095a576020820181803883390190505b50905060001982015b85156109a857600a860660300160f81b8282806001900393508151811061098657fe5b60200101906001600160f81b031916908160001a905350600a86049550610963565b50949350505050565b60608082518451865188518a518c518e510101010101016040519080825280601f01601f1916602001820160405280156109f2576020820181803883390190505b5090506000805b8a51811015610a4a578a8181518110610a0e57fe5b602001015160f81c60f81b838380600101945081518110610a2b57fe5b60200101906001600160f81b031916908160001a9053506001016109f9565b5060005b8951811015610a9f57898181518110610a6357fe5b602001015160f81c60f81b838380600101945081518110610a8057fe5b60200101906001600160f81b031916908160001a905350600101610a4e565b5060005b8851811015610af457888181518110610ab857fe5b602001015160f81c60f81b838380600101945081518110610ad557fe5b60200101906001600160f81b031916908160001a905350600101610aa3565b5060005b8751811015610b4957878181518110610b0d57fe5b602001015160f81c60f81b838380600101945081518110610b2a57fe5b60200101906001600160f81b031916908160001a905350600101610af8565b5060005b8651811015610b9e57868181518110610b6257fe5b602001015160f81c60f81b838380600101945081518110610b7f57fe5b60200101906001600160f81b031916908160001a905350600101610b4d565b5060005b8551811015610bf357858181518110610bb757fe5b602001015160f81c60f81b838380600101945081518110610bd457fe5b60200101906001600160f81b031916908160001a905350600101610ba2565b5060005b8451811015610c4857848181518110610c0c57fe5b602001015160f81c60f81b838380600101945081518110610c2957fe5b60200101906001600160f81b031916908160001a905350600101610bf7565b50909998505050505050505050565b60008184841115610c7b5760405162461bcd60e51b815260040161016f919061116a565b505050900390565b8035610756816112b1565b600082601f830112610c9f57600080fd5b8135610cb2610cad82611210565b6111e9565b91508181835260208401935060208101905083856040840282011115610cd757600080fd5b60005b83811015610d055781610ced8882610d25565b84525060209092019160409190910190600101610cda565b5050505092915050565b8051610756816112c5565b8035610756816112ce565b600060408284031215610d3757600080fd5b610d4160406111e9565b90506000610d4f8484610c83565b8252506020610d6084848301610d1a565b60208301525092915050565b8035610756816112d7565b600060208284031215610d8957600080fd5b60006107098484610c83565b600060208284031215610da757600080fd5b813567ffffffffffffffff811115610dbe57600080fd5b61070984828501610c8e565b60008060008060808587031215610de057600080fd5b843567ffffffffffffffff811115610df757600080fd5b610e0387828801610c8e565b9450506020610e1487828801610d6c565b9350506040610e2587828801610d1a565b9250506060610e3687828801610d1a565b91505092959194509250565b600060208284031215610e5457600080fd5b60006107098484610d0f565b6000610e6c838361109c565b505060400190565b610e7d81611269565b82525050565b610e7d81611244565b6000610e9782611237565b610ea1818561123b565b9350610eac83611231565b8060005b83811015610eda578151610ec48882610e60565b9750610ecf83611231565b925050600101610eb0565b509495945050505050565b610e7d8161124f565b610e7d81611254565b610e7d81611270565b6000610f0b82611237565b610f15818561123b565b9350610f2581856020860161127b565b610f2e816112a7565b9093019392505050565b6000610f4560268361123b565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b6000610f8d60238361123b565b7f6d73672e73656e646572206e6f7420666f756e6420696e2072656365697069658152626e747360e81b602082015260400192915050565b6000610fd260108361123b565b6f6e6f7468696e6720746f20636c61696d60801b815260200192915050565b6000610ffe60208361123b565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000611037601a8361123b565b7f6f776e65722073686f756c64207369676e2062616c616e636573000000000000815260200192915050565b6000611070601a8361123b565b7f7472616e73666572206973206e6f74207375636365737366756c000000000000815260200192915050565b805160408301906110ad8482610e83565b5060208201516105906020850182610eee565b610e7d81611263565b602081016107568284610e83565b606081016110e58286610e83565b6110f26020830185610e74565b6107096040830184610eee565b602080825281016107538184610e8c565b602081016107568284610ee5565b6080810161112c8287610eee565b61113960208301866110c0565b6111466040830185610eee565b6111536060830184610eee565b95945050505050565b602081016107568284610ef7565b602080825281016107538184610f00565b6020808252810161062b81610f38565b6020808252810161062b81610f80565b6020808252810161062b81610fc5565b6020808252810161062b81610ff1565b6020808252810161062b8161102a565b6020808252810161062b81611063565b602081016107568284610eee565b60405181810167ffffffffffffffff8111828210171561120857600080fd5b604052919050565b600067ffffffffffffffff82111561122757600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b600061062b82611257565b151590565b90565b6001600160a01b031690565b60ff1690565b600061062b825b600061062b82611244565b60005b8381101561129657818101518382015260200161127e565b838111156105905750506000910152565b601f01601f191690565b6112ba81611244565b81146105e457600080fd5b6112ba8161124f565b6112ba81611254565b6112ba8161126356fea365627a7a72315820fa37b3c7b998a0ca5d4909ea71b10bda00d1d614b97014cf6fae5a979642ddea6c6578706572696d656e74616cf564736f6c63430005110040
Verified Source Code Partial Match
Compiler: v0.5.17+commit.d19bba13
EVM: istanbul
Optimization: Yes (200 runs)
RariMineV2.sol 713 lines
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library UintLibrary {
function toString(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (_i != 0) {
bstr[k--] = byte(uint8(48 + _i % 10));
_i /= 10;
}
return string(bstr);
}
}
library StringLibrary {
using UintLibrary for uint256;
function append(string memory _a, string memory _b) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory bab = new bytes(_ba.length + _bb.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bab[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) bab[k++] = _bb[i];
return string(bab);
}
function append(string memory _a, string memory _b, string memory _c) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory bbb = new bytes(_ba.length + _bb.length + _bc.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bbb[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) bbb[k++] = _bb[i];
for (uint i = 0; i < _bc.length; i++) bbb[k++] = _bc[i];
return string(bbb);
}
function recover(string memory message, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
bytes memory msgBytes = bytes(message);
bytes memory fullMessage = concat(
bytes("\x19Ethereum Signed Message:\n"),
bytes(msgBytes.length.toString()),
msgBytes,
new bytes(0), new bytes(0), new bytes(0), new bytes(0)
);
return ecrecover(keccak256(fullMessage), v, r, s);
}
function concat(bytes memory _ba, bytes memory _bb, bytes memory _bc, bytes memory _bd, bytes memory _be, bytes memory _bf, bytes memory _bg) internal pure returns (bytes memory) {
bytes memory resultBytes = new bytes(_ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) resultBytes[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) resultBytes[k++] = _bb[i];
for (uint i = 0; i < _bc.length; i++) resultBytes[k++] = _bc[i];
for (uint i = 0; i < _bd.length; i++) resultBytes[k++] = _bd[i];
for (uint i = 0; i < _be.length; i++) resultBytes[k++] = _be[i];
for (uint i = 0; i < _bf.length; i++) resultBytes[k++] = _bf[i];
for (uint i = 0; i < _bg.length; i++) resultBytes[k++] = _bg[i];
return resultBytes;
}
}
library AddressLibrary {
function toString(address _addr) internal pure returns (string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(42);
str[0] = '0';
str[1] = 'x';
for (uint256 i = 0; i < 20; i++) {
str[2+i*2] = alphabet[uint8(value[i + 12] >> 4)];
str[3+i*2] = alphabet[uint8(value[i + 12] & 0x0f)];
}
return string(str);
}
}
contract RariMineV2 is Ownable {
using SafeMath for uint;
using StringLibrary for string;
using UintLibrary for uint;
using AddressLibrary for address;
event Claim(address indexed owner, uint value);
event Value(address indexed owner, uint value);
struct Balance {
address recipient;
uint256 value;
}
ERC20 public token;
address public tokenOwner;
mapping(address => uint) public claimed;
constructor(ERC20 _token, address _tokenOwner) public {
token = _token;
tokenOwner = _tokenOwner;
}
function claim(Balance[] memory _balances, uint8 v, bytes32 r, bytes32 s) public {
require(prepareMessage(_balances).recover(v, r, s) == owner(), "owner should sign balances");
for (uint i = 0; i < _balances.length; i++) {
address recipient = _balances[i].recipient;
if (msg.sender == recipient) {
uint toClaim = _balances[i].value.sub(claimed[recipient]);
require(toClaim > 0, "nothing to claim");
claimed[recipient] = _balances[i].value;
require(token.transferFrom(tokenOwner, msg.sender, toClaim), "transfer is not successful");
emit Claim(recipient, toClaim);
emit Value(recipient, _balances[i].value);
return;
}
}
revert("msg.sender not found in receipients");
}
function doOverride(Balance[] memory _balances) public onlyOwner {
for (uint i = 0; i < _balances.length; i++) {
claimed[_balances[i].recipient] = _balances[i].value;
emit Value(_balances[i].recipient, _balances[i].value);
}
}
function prepareMessage(Balance[] memory _balances) internal returns (string memory) {
return toString(keccak256(abi.encode(_balances)));
}
function toString(bytes32 value) internal pure returns (string memory) {
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(64);
for (uint256 i = 0; i < 32; i++) {
str[i*2] = alphabet[uint8(value[i] >> 4)];
str[1+i*2] = alphabet[uint8(value[i] & 0x0f)];
}
return string(str);
}
}
Read Contract
claimed 0xc884ef83 → uint256
isOwner 0x8f32d59b → bool
owner 0x8da5cb5b → address
token 0xfc0c546a → address
tokenOwner 0xa3e67610 → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0xaac21324
tuple[] _balances
uint8 v
bytes32 r
bytes32 s
doOverride 0x18b43366
tuple[] _balances
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address