Verified contractPartial
DSWP
Address0x000000d4e883e304c7f9574ebeecf238eb55a40f
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.4.24
- Same code
Only this contract
Details
- Compiler
- solc 0.4.24+commit.e67f0147
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 6,131,819
- Creation transaction
- 0x86feecc201…22a44c3050
DSWP.sol
pragma solidity ^0.4.24;
interface TokenReceiver {
function tokenFallback(address from, uint256 qty, bytes data) external;
}
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract DSWP {
using SafeMath for uint256;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
uint256 public decimals = 18;
string public name = "Darkswap";
string public symbol = "DSWP";
uint256 public totalSupply = 1e22;
event Transfer(address indexed from, address indexed to, uint256 qty);
event Approval(address indexed from, address indexed spender, uint256 qty);
constructor() public {
balanceOf[msg.sender] = totalSupply;
}
function isContract(address target) internal view returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(target)
}
return codeLength > 0;
}
function transfer(address target, uint256 qty) external returns (bool) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(qty);
balanceOf[target] = balanceOf[target].add(qty);
if (isContract(target)) {
TokenReceiver(target).tokenFallback(target, qty, "");
}
emit Transfer(msg.sender, target, qty);
return true;
}
function transfer(address target, uint256 qty, bytes data) external returns (bool) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(qty);
balanceOf[target] = balanceOf[target].add(qty);
if (isContract(target)) {
TokenReceiver(target).tokenFallback(target, qty, data);
}
emit Transfer(msg.sender, target, qty);
return true;
}
function transferFrom(address from, address to, uint256 qty) external returns (bool) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(qty);
balanceOf[from] = balanceOf[from].sub(qty);
balanceOf[to] = balanceOf[to].add(qty);
emit Transfer(from, to, qty);
return true;
}
function approve(address spender, uint256 qty) external returns (bool) {
allowance[msg.sender][spender] = qty;
emit Approval(msg.sender, spender, qty);
return true;
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.