pragma solidity ^0.5.8;
//Change the contract name to your token name
contract YEARNYFINETWORK {
// Name your custom token
string public constant name = "YEARNYFI.NETWORK";
// Name your custom token symbol
string public constant symbol = "YNI";
uint8 public constant decimals = 18;
// Contract owner will be your Link account
address public owner;
address public treasury;
uint256 public totalSupply;
mapping (address => mapping (address => uint256)) private allowed;
mapping (address => uint256) private balances;
event Approval(address indexed tokenholder, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {
owner = msg.sender;
// Add your wallet address here which will contain your total token supply
treasury = address(0xD982633b51b5b255d261fd222f269ac9fC9313B9);
// Set your total token supply (default 18000)
totalSupply = 18000 * 10**uint(decimals);
balances[treasury] = totalSupply;
emit Transfer(address(0), treasury, totalSupply);
}
function () external payable {
revert();
}
function allowance(address _tokenholder, address _spender) public view returns (uint256 remaining) {
return allowed[_tokenholder][_spender];
}
function approve(address _spender, uint256 _value) public returns (bool) {
require(_spender != address(0));
require(_spender != msg.sender);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function balanceOf(address _tokenholder) public view returns (uint256 balance) {
return balances[_tokenholder];
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
require(_spender != address(0));
require(_spender != msg.sender);
if (allowed[msg.sender][_spender] <= _subtractedValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender] - _subtractedValue;
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
require(_spender != address(0));
require(_spender != msg.sender);
require(allowed[msg.sender][_spender] <= allowed[msg.sender][_spender] + _addedValue);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender] + _addedValue;
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != msg.sender);
require(_to != address(0));
require(_to != address(this));
require(balances[msg.sender] - _value <= balances[msg.sender]);
require(balances[_to] <= balances[_to] + _value);
require(_value <= transferableTokens(msg.sender));
balances[msg.sender] = balances[msg.sender] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_from != address(0));
require(_from != address(this));
require(_to != _from);
require(_to != address(0));
require(_to != address(this));
require(_value <= transferableTokens(_from));
require(allowed[_from][msg.sender] - _value <= allowed[_from][msg.sender]);
require(balances[_from] - _value <= balances[_from]);
require(balances[_to] <= balances[_to] + _value);
allowed[_from][msg.sender] = allowed[_from][msg.sender] - _value;
balances[_from] = balances[_from] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(_from, _to, _value);
return true;
}
function transferOwnership(address _newOwner) public {
require(msg.sender == owner);
require(_newOwner != address(0));
require(_newOwner != address(this));
require(_newOwner != owner);
address previousOwner = owner;
owner = _newOwner;
emit OwnershipTransferred(previousOwner, _newOwner);
}
function transferableTokens(address holder) public view returns (uint256) {
return balanceOf(holder);
}
}
{
"compilationTarget": {
"YEARNYFINETWORK.sol": "YEARNYFINETWORK"
},
"evmVersion": "istanbul",
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenholder","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[{"internalType":"address","name":"_tokenholder","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_tokenholder","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"transferableTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]