parent
d72bd5a1a1
commit
4a7211e5d1
File diff suppressed because one or more lines are too long
@ -0,0 +1,33 @@ |
|||||||
|
{ |
||||||
|
"language": "Solidity", |
||||||
|
"sources": { |
||||||
|
"./simple_storage.sol": { |
||||||
|
"content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title Owner\n * @dev Set & change owner\n */\ncontract Owner {\n\n address private owner;\n \n // event for EVM logging 2345678ewqwertyui54567890987654345678\n event OwnerSet(address indexed oldOwner, address indexed newOwner);\n \n // modifier to check if caller is owner\n modifier isOwner() {\n // If the first argument of 'require' evaluates to 'false', execution terminates and all\n // changes to the state and to Ether balances are reverted.\n // This used to consume all gas in old EVM versions, but not anymore.\n // It is often a good idea to use 'require' to check if functions are called correctly.\n // As a second argument, you can also provide an explanation about what went wrong.\n require(msg.sender == owner, \"Caller is not owner\");\n _;\n }\n \n /**\n * @dev Set contract deployer as owner\n */\n constructor(uint112 abc, address abb, bytes32 ghnc) {\n // console.log(\"Owner contract deployed by:\", msg.sender);\n owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor\n emit OwnerSet(address(0), owner);\n }\n\n /**\n * @dev Change owner\n * @param newOwner address of new owner\n */\n function changeOwner(address newOwner) public isOwner {\n emit OwnerSet(owner, newOwner);\n owner = newOwner;\n }\n\n /**\n * @dev Return owner address \n * @return address of owner\n */\n function getOwner() external view returns (address) {\n return owner;\n }\n}" |
||||||
|
} |
||||||
|
}, |
||||||
|
"settings": { |
||||||
|
"evmVersion":"london", |
||||||
|
"metadata": { |
||||||
|
"useLiteralContent": true |
||||||
|
}, |
||||||
|
"optimizer": { |
||||||
|
"enabled": true, |
||||||
|
"runs": 199 |
||||||
|
}, |
||||||
|
"outputSelection": { |
||||||
|
"*": { |
||||||
|
"*": [ |
||||||
|
"abi", |
||||||
|
"evm.bytecode", |
||||||
|
"evm.deployedBytecode", |
||||||
|
"evm.methodIdentifiers" |
||||||
|
], |
||||||
|
"": [ |
||||||
|
"id", |
||||||
|
"ast" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,105 @@ |
|||||||
|
from vyper.interfaces import ERC20 |
||||||
|
|
||||||
|
implements: ERC20 |
||||||
|
|
||||||
|
event Transfer: |
||||||
|
sender: indexed(address) |
||||||
|
receiver: indexed(address) |
||||||
|
value: uint256 |
||||||
|
|
||||||
|
event Approval: |
||||||
|
owner: indexed(address) |
||||||
|
spender: indexed(address) |
||||||
|
value: uint256 |
||||||
|
|
||||||
|
name: public(String[64]) |
||||||
|
symbol: public(String[32]) |
||||||
|
decimals: public(uint256) |
||||||
|
|
||||||
|
balanceOf: public(HashMap[address, uint256]) |
||||||
|
allowance: public(HashMap[address, HashMap[address, uint256]]) |
||||||
|
totalSupply: public(uint256) |
||||||
|
minter: address |
||||||
|
_supply: uint256 |
||||||
|
_check: uint256 #1% of the total supply check |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def __init__(): |
||||||
|
self._supply = 10_000_000_000 |
||||||
|
self._check = 100_000_000 |
||||||
|
self.decimals = 18 |
||||||
|
self.name = 'Kooopa' |
||||||
|
self.symbol = 'KOO' |
||||||
|
|
||||||
|
init_supply: uint256 = self._supply * 10 ** self.decimals |
||||||
|
|
||||||
|
self.balanceOf[msg.sender] = init_supply |
||||||
|
self.totalSupply = init_supply |
||||||
|
self.minter = msg.sender |
||||||
|
|
||||||
|
log Transfer(ZERO_ADDRESS, msg.sender, init_supply) |
||||||
|
|
||||||
|
|
||||||
|
@internal |
||||||
|
def _transfer(_from : address, _to : address, _value : uint256) -> bool: |
||||||
|
assert _value <= self._check, 'Transfer limit of 1%(100 Million) Tokens' |
||||||
|
|
||||||
|
TargetBalance: uint256 = self.balanceOf[_to] + _value |
||||||
|
assert TargetBalance <= self._check, 'Single wallet cannot hold more than 1%(100 Million) Tokens' |
||||||
|
|
||||||
|
self.balanceOf[_from] -= _value |
||||||
|
self.balanceOf[_to] += _value |
||||||
|
log Transfer(_from, _to, _value) |
||||||
|
return True |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def transfer(_to : address, _value : uint256) -> bool: |
||||||
|
self._transfer(msg.sender, _to, _value) |
||||||
|
return True |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def transferFrom(_from : address, _to : address, _value : uint256) -> bool: |
||||||
|
self._transfer(_from, _to, _value) |
||||||
|
self.allowance[_from][msg.sender] -= _value |
||||||
|
return True |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def approve(_spender : address, _value : uint256) -> bool: |
||||||
|
assert _value <= self._check, 'Cant Approve more than 1%(100 Million) Tokens for transfer' |
||||||
|
|
||||||
|
self.allowance[msg.sender][_spender] = _value |
||||||
|
log Approval(msg.sender, _spender, _value) |
||||||
|
return True |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def mint(_to: address, _value: uint256): |
||||||
|
assert msg.sender == self.minter |
||||||
|
assert _to != ZERO_ADDRESS |
||||||
|
self.totalSupply += _value |
||||||
|
self.balanceOf[_to] += _value |
||||||
|
log Transfer(ZERO_ADDRESS, _to, _value) |
||||||
|
|
||||||
|
|
||||||
|
@internal |
||||||
|
def _burn(_to: address, _value: uint256): |
||||||
|
|
||||||
|
assert _to != ZERO_ADDRESS |
||||||
|
self.totalSupply -= _value |
||||||
|
self.balanceOf[_to] -= _value |
||||||
|
log Transfer(_to, ZERO_ADDRESS, _value) |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def burn(_value: uint256): |
||||||
|
self._burn(msg.sender, _value) |
||||||
|
|
||||||
|
|
||||||
|
@external |
||||||
|
def burnFrom(_to: address, _value: uint256): |
||||||
|
self.allowance[_to][msg.sender] -= _value |
||||||
|
self._burn(_to, _value) |
Loading…
Reference in new issue