Transaction Hash:
Block:
10998042 at Oct-05-2020 09:00:03 PM +UTC
Transaction Fee:
0.003011344 ETH
$5.63
Gas Used:
61,456 Gas / 49 Gwei
Emitted Events:
271 |
YFMSToken.Transfer( from=[Sender] 0x9ffeeb61df398e790f651e91e1d99c8adc43a791, to=[Receiver] YFMSTokenSwap, value=3651028127183628511 )
|
272 |
LunaCoreToken.Transfer( from=0xcC249D41F3b4ea5C79EC82F5F0D91f39CFa2B92d, to=[Sender] 0x9ffeeb61df398e790f651e91e1d99c8adc43a791, value=3651028127183628511 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x547d6118...c5634B9C9 | |||||
0x5A0b54D5...D3E029c4c
Miner
| (Spark Pool) | 81.246494161148695394 Eth | 81.249505505148695394 Eth | 0.003011344 | |
0x9FfEEb61...AdC43A791 |
0.055794533 Eth
Nonce: 3
|
0.052783189 Eth
Nonce: 4
| 0.003011344 | ||
0xfef3bEf7...67ae5B106 |
Execution Trace
YFMSTokenSwap.CALL( )
-
YFMSToken.balanceOf( who=0x9FfEEb61Df398E790F651E91e1d99c8AdC43A791 ) => ( 3651028127183628511 )
-
YFMSToken.transferFrom( _from=0x9FfEEb61Df398E790F651E91e1d99c8AdC43A791, _to=0x6905D31cFD9237286D67CeC29c83e86568833B5F, _value=3651028127183628511 ) => ( success=True )
-
LunaCoreToken.transferFrom( _from=0xcC249D41F3b4ea5C79EC82F5F0D91f39CFa2B92d, _to=0x9FfEEb61Df398E790F651E91e1d99c8AdC43A791, _value=3651028127183628511 ) => ( success=True )
File 1 of 3: YFMSTokenSwap
File 2 of 3: YFMSToken
File 3 of 3: LunaCoreToken
pragma solidity 0.6.8; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } interface ERC20 { function balanceOf(address who) external view returns (uint256); function transfer(address to, uint value) external returns (bool success); function transferFrom(address from, address to, uint256 value) external returns (bool success); function approve(address spender, uint value) external returns (bool success); } contract YFMSTokenSwap { using SafeMath for uint256; ERC20 public YFMSToken; ERC20 public LUCRToken; address public owner; constructor(address yfms, address lucr) public { owner = msg.sender; YFMSToken = ERC20(yfms); LUCRToken = ERC20(lucr); } function swap () public { uint256 balance = YFMSToken.balanceOf(msg.sender); require(balance > 0, "balance must be greater than 0"); require(YFMSToken.transferFrom(msg.sender, address(this), balance), "YFMS transfer failed"); require(LUCRToken.transferFrom(owner, msg.sender, balance), "LUCR transfer failed"); } function withdrawYFMS () public { require(msg.sender == owner); YFMSToken.transfer(owner, YFMSToken.balanceOf(address(this))); } }
File 2 of 3: YFMSToken
pragma solidity 0.6.0; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } contract Ownable { address public _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () public { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == msg.sender, "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract YFMSToken is Ownable { using SafeMath for uint256; // standard ERC20 variables. string public constant name = "YFMoonshot"; string public constant symbol = "YFMS"; uint256 public constant decimals = 18; // the supply will not exceed 35,000 YFMS uint256 private constant _maximumSupply = 35000 * 10 ** decimals; uint256 private constant _maximumPresaleBurnAmount = 10000 * 10 ** decimals; uint256 public _presaleBurnTotal = 0; uint256 public _stakingBurnTotal = 0; // owner of the contract uint256 public _totalSupply; // events event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); // mappings mapping(address => uint256) public _balanceOf; mapping(address => mapping(address => uint256)) public allowance; constructor() public override { // transfer the entire supply into the address of the Contract creator. _owner = msg.sender; _totalSupply = _maximumSupply; _balanceOf[msg.sender] = _maximumSupply; emit Transfer(address(0x0), msg.sender, _maximumSupply); } function totalSupply () public view returns (uint256) { return _totalSupply; } function balanceOf (address who) public view returns (uint256) { return _balanceOf[who]; } // ensure the address is valid. function _transfer(address _from, address _to, uint256 _value) internal { _balanceOf[_from] = _balanceOf[_from].sub(_value); _balanceOf[_to] = _balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); } // send tokens function transfer(address _to, uint256 _value) public returns (bool success) { require(_balanceOf[msg.sender] >= _value); _transfer(msg.sender, _to, _value); return true; } // handles presale burn + staking burn. function burn (uint256 _burnAmount, bool _presaleBurn) public onlyOwner returns (bool success) { if (_presaleBurn) { require(_presaleBurnTotal.add(_burnAmount) <= _maximumPresaleBurnAmount); require(_balanceOf[msg.sender] >= _burnAmount); _presaleBurnTotal = _presaleBurnTotal.add(_burnAmount); _transfer(_owner, address(0), _burnAmount); _totalSupply = _totalSupply.sub(_burnAmount); } else { require(_balanceOf[msg.sender] >= _burnAmount); _transfer(_owner, address(0), _burnAmount); _totalSupply = _totalSupply.sub(_burnAmount); } return true; } // approve tokens function approve(address _spender, uint256 _value) public returns (bool success) { require(_spender != address(0)); allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } // transfer from function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= _balanceOf[_from]); require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); _transfer(_from, _to, _value); return true; } }
File 3 of 3: LunaCoreToken
pragma solidity 0.6.0; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } contract Ownable { address public _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () public { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == msg.sender, "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract LunaCoreToken is Ownable { using SafeMath for uint256; // standard ERC20 variables. string public constant name = "LunaCore"; string public constant symbol = "LUCR"; uint256 public constant decimals = 18; // the supply will not exceed 25,000 uint256 private constant _maximumSupply = 25000 * 10 ** decimals; // owner of the contract uint256 public _totalSupply; // events event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); // mappings mapping(address => uint256) public _balanceOf; mapping(address => mapping(address => uint256)) public allowance; constructor() public override { // transfer the entire supply into the address of the Contract creator. _owner = msg.sender; _totalSupply = _maximumSupply; _balanceOf[msg.sender] = _maximumSupply; emit Transfer(address(0), msg.sender, _maximumSupply); } function totalSupply () public view returns (uint256) { return _totalSupply; } function balanceOf (address who) public view returns (uint256) { return _balanceOf[who]; } // ensure the address is valid. function _transfer(address _from, address _to, uint256 _value) internal { _balanceOf[_from] = _balanceOf[_from].sub(_value); _balanceOf[_to] = _balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); } // send tokens function transfer(address _to, uint256 _value) public returns (bool success) { require(_balanceOf[msg.sender] >= _value); _transfer(msg.sender, _to, _value); return true; } // handles presale burn + staking burn. function burn (uint256 _burnAmount) public onlyOwner returns (bool success) { _transfer(_owner, address(0), _burnAmount); _totalSupply = _totalSupply.sub(_burnAmount); return true; } // approve tokens function approve(address _spender, uint256 _value) public returns (bool success) { require(_spender != address(0)); allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } // transfer from function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= _balanceOf[_from]); require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); _transfer(_from, _to, _value); return true; } }