{
address: "0x2347d36cf0d94b98bab6d6d41c6f94d7214830ad",
balance: {
type: "BigNumber",
hex: "0x00"
string: "0"
ether: "0.0"
},
"transactions": [],
code: "/*
Name: Wrapped BNB => Wrapped KARMA
Version: 0.0.3
Source:
- WBNB: https://github.com/pancakeswap/pancake-farm/blob/master/contracts/libs/WBNB.sol
Deploy: https://bscscan.com/address/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
*/
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 WKARMA extends ERC20Token {
name = 'Wrapped KARMA';
symbol = 'WKARMA';
deposit() {
if (! (msg.sender in this.balances)) {
this.balances[msg.sender] = number(0);
}
this.balances[msg.sender] = this.balances[msg.sender].add(msg.value);
this.totalSupply = this.totalSupply.add(msg.value);
require(this.totalSupply.eq(address(this).balance), 'TOTAL_SUPPLY_MISMATCH');
this.drain();
emit('Deposit', [msg.sender, msg.value]);
}
Deposit(sender, value) {} // event
withdraw(wad) {
require(msg.sender in this.balances && ! this.balances[msg.sender].lt(wad));
this.drain();
this.balances[msg.sender] = this.balances[msg.sender].sub(wad);
this.totalSupply = this.totalSupply.sub(wad);
address(msg.sender).transfer(wad);
require(this.totalSupply.eq(address(this).balance), 'TOTAL_SUPPLY_MISMATCH');
emit('Withdrawal', [msg.sender, wad]);
}
Withdrawal(sender, value) {} // event
drain() {
if (address(this).balance.gt(this.totalSupply)) {
const overBalance = address(this).balance.sub(this.totalSupply);
address(this.owner).transfer(overBalance);
emit('Drain', [msg.sender, overBalance]);
}
}
Drain(sender, value) {} // event
}
// Events
WKARMA.prototype.Deposit.event = true;
WKARMA.prototype.Deposit.inputs = ['address indexed', 'uint256'];
WKARMA.prototype.Withdrawal.event = true;
WKARMA.prototype.Withdrawal.inputs = ['address indexed', 'uint256'];
WKARMA.prototype.Drain.event = true;
WKARMA.prototype.Drain.inputs = ['address indexed', 'uint256'];
// Methods
WKARMA.prototype.deposit.payable = true;
WKARMA.prototype.withdraw.inputs = ['uint256'];
return WKARMA;
",
codeHash: "0xb509231997a77b225178905db5d62a4a30c04d52130f2e59ce5b4206d6189d81",
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"
},
0xd0e30db0: {
"inputs": [],
name: "deposit",
"outputs": [],
stateMutability: "payable",
type: "function"
},
0xe1fffcc4: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "value",
type: "uint256",
indexed: false
}
],
name: "Deposit",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x2e1a7d4d: {
inputs: [
{
name: "wad",
type: "uint256"
}
],
name: "withdraw",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0x7fcf532c: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "value",
type: "uint256",
indexed: false
}
],
name: "Withdrawal",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x9890220b: {
"inputs": [],
name: "drain",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0xf36f4d66: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "value",
type: "uint256",
indexed: false
}
],
name: "Drain",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
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: "WKARMA",
storage: {
owner: "0x131a190fa22cb867abf58193bf9e7640e9fce682",
name: "Wrapped KARMA",
symbol: "WKARMA",
decimals: 18,
totalSupply: {
type: "BigNumber",
hex: "0x00"
string: "0"
ether: "0.0"
},
"allowed": {},
"balances": {},
supportedInterfaces: {
0x36372b07: true,
0x06fdde03: true,
0x95d89b41: true,
0x313ce567: true
},
prototype: {
address: "0x2347d36cf0d94b98bab6d6d41c6f94d7214830ad"
}
},
storageHash: "0xb48d38f93eaa084033fc5970bf96e559c33c4cdc07d889ab00b4d63f9590739d",
savedOnBlockNumber: {
type: "BigNumber",
hex: "0x00"
string: "0"
ether: "0.0"
}
}