// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract DBANK is ERC20 {
string public constant _name = "DBANK";
string public constant _symbol = "DBN";
uint8 public constant _decimal = 18;

// total supply of Locker
uint256 public _totalSupply = 10**27;

// saves the individual address balances
mapping(address => uint256) _balanceOf;

// tracks how much amount could contract spend on the behalf of the user
mapping(address => mapping(address => uint256)) allowances;


constructor() ERC20(_name, _symbol){
// transfer totalSupply to owner at deployment
_balanceOf[msg.sender] = _totalSupply;
_mint(msg.sender, _totalSupply);
}


modifier checkDeadAddress(address checkAddress) {
require(checkAddress != address(0), "address should not be dead adress");
_;
}


function name() public pure override returns (string memory) {
return _name;
}

function symbol() public pure override returns (string memory) {
return _symbol;
}

function decimals() public pure override returns (uint8) {
return _decimal;
}

// returns totalSupply
function totalSupply() public override view returns(uint256 totalSupply_) {
return _totalSupply;
}

// returns balanceOf individual user
function balanceOf(address _owner) public view override returns(uint256 balanceOf_) {
return _balanceOf[_owner];
}

function transfer(address _to, uint256 _value) checkDeadAddress(_to) public override returns(bool success) {
require(_balanceOf[msg.sender] > _value, "Not enough balance!");
_balanceOf[msg.sender] -= _value;
_balanceOf[_to] += _value;

emit Transfer(msg.sender, _to, _value);
return true;
}

function approve(address _spender, uint256 _value) checkDeadAddress(_spender) public override returns(bool success) {
allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}

function allowance(address _owner, address _spender) public override view returns(uint256 remaining) {
require(_owner != address(0), "User should not be 0 address");
require(_spender != address(0), "Spender should not be 0 address");
return allowances[_owner][_spender];
}

function transferFrom(address _from, address _to, uint256 _value) checkDeadAddress(_to) public override returns(bool success) {
require(_balanceOf[_from] > _value, "Balance not enough!");
require(allowances[_from][_to] >= _value, "Not allowed more than allowed");

_balanceOf[_from] -= _value;
allowances[_from][_to] -= _value;
_balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;

}

}


am i doing something wrong ?

Sep 1, 2021, 1:57 PM
Refresh the page
Sep 1, 2021, 2:07 PM
you mean to refresh ropsten etherscan page ?
issue is something else
I can't seem to find it
my fault , i was compiling the erc20 openzepplin file the whole time
Sep 1, 2021, 2:28 PM

© 2024 Draquery.com All rights reserved.