Contract Source Code:
File 1 of 1 : ERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom( address sender, address recipient, uint amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } contract PDAI is IERC20 { uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; string public name = "Piggylet DAI"; string public symbol = "pDAI"; uint8 public decimals = 18; function transfer(address recipient, uint amount) external returns (bool) { balanceOf[msg.sender] -= amount; balanceOf[recipient] += amount; emit Transfer(msg.sender, recipient, amount); return true; } // Modifier to check that the caller is the owner of // the contract. function approve(address spender, uint amount) external returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transferFrom( address sender, address recipient, uint amount ) external returns (bool) { allowance[sender][msg.sender] -= amount; balanceOf[sender] -= amount; balanceOf[recipient] += amount; emit Transfer(sender, recipient, amount); return true; } function mint(uint amount) external { balanceOf[msg.sender] += amount*(10 ** decimals); totalSupply += amount*(10 ** decimals); emit Transfer(address(0), msg.sender, amount); } function burn(uint amount) external { balanceOf[msg.sender] -= amount*(10 ** decimals); totalSupply -= amount*(10 ** decimals); emit Transfer(msg.sender, address(0), amount); } }
Please enter a contract address above to load the contract details and source code.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.