{
address: "0xffafbe052c786154f7e85cbe67f1d118f5b55b25",
balance: {
type: "BigNumber",
hex: "0x00"
string: "0"
ether: "0.0"
},
"transactions": [],
code: "/*
Name: BASIC Token
Version: 0.0.3
*/
class Ownable {
owner = '0x0000000000000000000000000000000000000000';
OwnershipTransferred(oldOwner, newOwner) {} // event
constructor() {
this.owner = msg.sender;
}
getOwner() {
return [this.owner];
}
transferOwnership(newOwner) {
require(newOwner != address(0), "Ownable: new owner is the zero address");
this._transferOwnership(newOwner);
}
_transferOwnership(newOwner) {
newOwner = newOwner.toLowerCase();
const oldOwner = this.owner;
this.owner = newOwner;
emit('OwnershipTransferred', [oldOwner, newOwner]);
}
_onlyOwner(next) {
require(msg.sender.toLowerCase() == this.owner, 'only owner can execute this');
next();
}
}
// Methods
Ownable.prototype.OwnershipTransferred.event = true;
Ownable.prototype.OwnershipTransferred.inputs = ['address indexed', 'address indexed'];
// Methods
Ownable.prototype.getOwner.view = true;
Ownable.prototype.getOwner.outputs = ['address'];
Ownable.prototype.transferOwnership.inputs = ['address'];
Ownable.prototype.transferOwnership.modifiers = ['_onlyOwner'];
Ownable.prototype._transferOwnership.internal = true;
Ownable.prototype._onlyOwner.internal = true;
class ERC20Token extends Ownable {
name = 'ERC20 Token';
symbol = 'ERC20';
decimals = 18;
totalSupply = number('0');
allowed = {};
balances = {};
supportedInterfaces = {
'0x36372b07': true, // ERC20
'0x06fdde03': true, // ERC20 name
'0x95d89b41': true, // ERC20 symbol
'0x313ce567': true, // ERC20 decimals
};
Transfer(sender, recipient, amount) {} // event
Approval(owner, spender, amount) {} // event
Mint(minter, amount) {} // event
Burn(burner, amount) {} // event
balanceOf(holderAddress) {
holderAddress = holderAddress.toLowerCase();
var tokenBalances = this.balances || {};
if (holderAddress in tokenBalances) {
const balance = tokenBalances[holderAddress];
return [balance];
}
return [number(0)];
}
transfer(recipient, amount) {
recipient = recipient.toLowerCase();
const sender = msg.sender;
var tokenBalances = this.balances || {};
if (! (sender in tokenBalances)) {
_throw('INSUFFICIENT_TOKEN_BALANCE');
}
if (tokenBalances[sender].lt(amount)) {
_throw('INSUFFICIENT_TOKEN_BALANCE');
}
if (this._decrementUserBalance.bind(this)(sender, amount)) {
this._incrementUserBalance.bind(this)(recipient, amount)
}
emit('Transfer', [sender, recipient, amount]);
return [true];
}
transferFrom(sender, recipient, amount) {
sender = sender.toLowerCase();
recipient = recipient.toLowerCase();
var tokenBalances = this.balances || {};
var tokenAllowances = this.allowed || {};
require(sender in tokenBalances, 'MISSING_TOKEN_BALANCE');
if (tokenBalances[sender].lt(amount)) {
_throw('INSUFFICIENT_TOKEN_BALANCE');
}
require(sender == msg.sender || (sender in tokenAllowances && msg.sender in tokenAllowances[sender]), "MISSING_ALLOWANCE");
if (sender != msg.sender && tokenAllowances[sender][msg.sender].lt(amount)) {
_throw('INSUFFICIENT_TOKEN_ALLOWANCE');
}
tokenAllowances[sender][msg.sender] = tokenAllowances[sender][msg.sender].sub(amount);
if (this._decrementUserBalance.bind(this)(sender, amount)) {
this._incrementUserBalance.bind(this)(recipient, amount)
}
emit('Transfer', [sender, recipient, amount]);
return [true];
}
allowance(owner, spender) {
owner = owner.toLowerCase();
spender = spender.toLowerCase();
var tokenAllowances = this.allowed || {};
if (owner in tokenAllowances && spender in tokenAllowances[owner]) {
return [tokenAllowances[owner][spender]];
}
return [number(0)];
}
approve(spender, value) {
spender = spender.toLowerCase();
var tokenAllowances = this.allowed || {};
if (! (msg.sender in tokenAllowances)) {
tokenAllowances[msg.sender] = {};
}
tokenAllowances[msg.sender][spender] = value;
emit('Approval', [msg.sender, spender, value]);
return [true];
}
mint(userAddress, amount) {
this._mint(userAddress, amount);
}
_mint(userAddress, amount) {
userAddress = userAddress.toLowerCase();
if (userAddress == address(0).address) {
_throw('ERC20: mint to the zero address');
}
if (this._incrementUserBalance.bind(this)(userAddress, amount)) {
this.totalSupply = this.totalSupply.add(amount);
}
emit('Mint', [userAddress, amount]);
}
burn(userAddress, amount) {
this._burn(userAddress, amount);
}
_burn(userAddress, amount) {
userAddress = userAddress.toLowerCase();
if (userAddress == address(0).address) {
_throw('ERC20: burn from the zero address');
}
if (this._decrementUserBalance.bind(this)(userAddress, amount)) {
this.totalSupply = this.totalSupply.sub(amount);
}
emit('Burn', [userAddress, amount]);
}
supportsInterface(interfaceID) {
const _interfaces = this.supportedInterfaces || {};
return [
((interfaceID in _interfaces)
? _interfaces[interfaceID]
: false)
];
}
_decrementUserBalance(holderAddress, amount) {
var tokenBalances = this.balances || {};
if (! (holderAddress in tokenBalances)) {
_throw('INSUFFICIENT_TOKEN_BALANCE');
}
if (amount.gt(tokenBalances[holderAddress])) {
_throw('INSUFFICIENT_TOKEN_BALANCE');
}
tokenBalances[holderAddress] = tokenBalances[holderAddress].sub(amount);
return true;
}
_incrementUserBalance(holderAddress, amount) {
var tokenBalances = this.balances || {};
if (! (holderAddress in tokenBalances)) {
tokenBalances[holderAddress] = number(0);
}
tokenBalances[holderAddress] = tokenBalances[holderAddress].add(amount);
return true;
}
}
// Events
ERC20Token.prototype.Transfer.event = true;
ERC20Token.prototype.Transfer.inputs = ['address indexed', 'address indexed', 'uint256'];
ERC20Token.prototype.Approval.event = true;
ERC20Token.prototype.Approval.inputs = ['address indexed', 'address indexed', 'uint256'];
ERC20Token.prototype.Mint.event = true;
ERC20Token.prototype.Mint.inputs = ['address indexed', 'uint256'];
ERC20Token.prototype.Burn.event = true;
ERC20Token.prototype.Burn.inputs = ['address indexed', 'uint256'];
// Methods
ERC20Token.prototype.balanceOf.view = true;
ERC20Token.prototype.balanceOf.inputs = ['address'];
ERC20Token.prototype.balanceOf.outputs = ['uint256'];
ERC20Token.prototype.transfer.inputs = ['address', 'uint256'];
ERC20Token.prototype.transfer.outputs = ['bool'];
ERC20Token.prototype.transferFrom.inputs = ['address', 'address', 'uint256'];
ERC20Token.prototype.transferFrom.outputs = ['bool'];
ERC20Token.prototype.allowance.view = true;
ERC20Token.prototype.allowance.inputs = ['address', 'address'];
ERC20Token.prototype.allowance.outputs = ['uint256'];
ERC20Token.prototype.approve.inputs = ['address', 'uint256'];
ERC20Token.prototype.approve.outputs = ['bool'];
ERC20Token.prototype.mint.inputs = ['address', 'uint256'];
ERC20Token.prototype.mint.modifiers = ['_onlyOwner'];
ERC20Token.prototype._mint.internal = true;
ERC20Token.prototype.burn.inputs = ['address', 'uint256'];
ERC20Token.prototype.burn.modifiers = ['_onlyOwner'];
ERC20Token.prototype._burn.internal = true;
ERC20Token.prototype.supportsInterface.view = true;
ERC20Token.prototype.supportsInterface.inputs = ['bytes4'];
ERC20Token.prototype.supportsInterface.outputs = ['bool'];
ERC20Token.prototype._decrementUserBalance.internal = true;
ERC20Token.prototype._incrementUserBalance.internal = true;
class BasicToken extends ERC20Token {
name = 'BASIC Token';
symbol = 'BASIC';
constructor() {
super();
this.totalSupply = number('42000000' + '000000000000000000'); // 42 000 000 BASIC
this.balances[msg.sender] = this.totalSupply;
}
}
return BasicToken;
",
codeHash: "0xc3882317a0d96b82310d94f886a4512c6586eb848541241c62f8d9a5b3f19a68",
codeAbi: {
0x8da5cb5b: {
constant: true,
"inputs": [],
name: "owner",
outputs: [
{
name: "",
type: "address"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x06fdde03: {
constant: true,
"inputs": [],
name: "name",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x95d89b41: {
constant: true,
"inputs": [],
name: "symbol",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x313ce567: {
constant: true,
"inputs": [],
name: "decimals",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x18160ddd: {
constant: true,
"inputs": [],
name: "totalSupply",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x19e1fca4: {
constant: true,
"inputs": [],
name: "allowed",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x7bb98a68: {
constant: true,
"inputs": [],
name: "balances",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x037cc0e6: {
constant: true,
"inputs": [],
name: "supportedInterfaces",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xa8ac9b50: {
constant: true,
"inputs": [],
name: "prototype",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xddf252ad: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "recipient",
type: "address",
indexed: true
},
{
name: "amount",
type: "uint256",
indexed: false
}
],
name: "Transfer",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x8c5be1e5: {
inputs: [
{
name: "owner",
type: "address",
indexed: true
},
{
name: "spender",
type: "address",
indexed: true
},
{
name: "amount",
type: "uint256",
indexed: false
}
],
name: "Approval",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x0f6798a5: {
inputs: [
{
name: "minter",
type: "address",
indexed: true
},
{
name: "amount",
type: "uint256",
indexed: false
}
],
name: "Mint",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0xcc16f5db: {
inputs: [
{
name: "burner",
type: "address",
indexed: true
},
{
name: "amount",
type: "uint256",
indexed: false
}
],
name: "Burn",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x70a08231: {
inputs: [
{
name: "holderAddress",
type: "address"
}
],
name: "balanceOf",
outputs: [
{
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
0xa9059cbb: {
inputs: [
{
name: "recipient",
type: "address"
},
{
name: "amount",
type: "uint256"
}
],
name: "transfer",
outputs: [
{
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
0x23b872dd: {
inputs: [
{
name: "sender",
type: "address"
},
{
name: "recipient",
type: "address"
},
{
name: "amount",
type: "uint256"
}
],
name: "transferFrom",
outputs: [
{
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
0xdd62ed3e: {
inputs: [
{
name: "owner",
type: "address"
},
{
name: "spender",
type: "address"
}
],
name: "allowance",
outputs: [
{
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
0x095ea7b3: {
inputs: [
{
name: "spender",
type: "address"
},
{
name: "value",
type: "uint256"
}
],
name: "approve",
outputs: [
{
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
0x40c10f19: {
inputs: [
{
name: "userAddress",
type: "address"
},
{
name: "amount",
type: "uint256"
}
],
name: "mint",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0x9dc29fac: {
inputs: [
{
name: "userAddress",
type: "address"
},
{
name: "amount",
type: "uint256"
}
],
name: "burn",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0x01ffc9a7: {
inputs: [
{
name: "interfaceID",
type: "bytes4"
}
],
name: "supportsInterface",
outputs: [
{
name: "",
type: "bool"
}
],
stateMutability: "view",
type: "function"
},
0x8be0079c: {
inputs: [
{
name: "oldOwner",
type: "address",
indexed: true
},
{
name: "newOwner",
type: "address",
indexed: true
}
],
name: "OwnershipTransferred",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x893d20e8: {
"inputs": [],
name: "getOwner",
outputs: [
{
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
0xf2fde38b: {
inputs: [
{
name: "newOwner",
type: "address"
}
],
name: "transferOwnership",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
}
},
contractName: "BasicToken",
storage: {
owner: "0x131a190fa22cb867abf58193bf9e7640e9fce682",
name: "BASIC Token",
symbol: "BASIC",
decimals: 18,
totalSupply: {
type: "BigNumber",
hex: "0x22bdd88fed9efc6a000000"
string: "42000000000000000000000000"
ether: "42000000.0"
},
"allowed": {},
balances: {
0x131a190fa22cb867abf58193bf9e7640e9fce682: {
type: "BigNumber",
hex: "0x22bdd88fed9efc6a000000"
string: "42000000000000000000000000"
ether: "42000000.0"
}
},
supportedInterfaces: {
0x36372b07: true,
0x06fdde03: true,
0x95d89b41: true,
0x313ce567: true
},
prototype: {
address: "0xffafbe052c786154f7e85cbe67f1d118f5b55b25"
}
},
storageHash: "0xb48d38f93eaa084033fc5970bf96e559c33c4cdc07d889ab00b4d63f9590739d",
savedOnBlockNumber: {
type: "BigNumber",
hex: "0x0a"
string: "10"
ether: "0.00000000000000001"
}
}