View Source: contracts/fakes/PoorMansERC20.sol
PoorMansERC20
Constants & Variables
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowed;
Events
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
- constructor(string _name, string _symbol, uint256 _supply)
- transfer(address _to, uint256 _value)
- transferFrom(address _from, address _to, uint256 _value)
- balanceOf(address _owner)
- approve(address _spender, uint256 _value)
- allowance(address _owner, address _spender)
function (string _name, string _symbol, uint256 _supply) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
_name | string | |
_symbol | string | |
_supply | uint256 |
Source Code
constructor(
string memory _name,
string memory _symbol,
uint256 _supply
) {
name = _name;
_symbol = symbol;
decimals = 18;
balances[msg.sender] = _supply;
totalSupply = _supply;
emit Transfer(address(0), msg.sender, _supply);
}
function transfer(address _to, uint256 _value) external nonpayable
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_to | address | |
_value | uint256 |
Source Code
function transfer(address _to, uint256 _value) external returns (bool) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
}
return false;
}
function transferFrom(address _from, address _to, uint256 _value) external nonpayable
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_from | address | |
_to | address | |
_value | uint256 |
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
}
return false;
}
function balanceOf(address _owner) external view
returns(balance uint256)
Arguments
Name | Type | Description |
---|---|---|
_owner | address |
Source Code
function balanceOf(address _owner) external view returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) external nonpayable
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_spender | address | |
_value | uint256 |
Source Code
function approve(address _spender, uint256 _value) external returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return false;
}
function allowance(address _owner, address _spender) external view
returns(remaining uint256)
Arguments
Name | Type | Description |
---|---|---|
_owner | address | |
_spender | address |
Source Code
function allowance(address _owner, address _spender) external view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundDaiDelegator
- FakePriceOracle
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundDaiDelegator
- Finalization
- ForceEther
- Governance
- GovernanceUtilV1
- IAaveV2LendingPoolLike
- IAccessControl
- IBondPool
- IClaimsProcessor
- ICompoundERC20DelegatorLike
- ICover
- ICoverReassurance
- ICoverStake
- ICxToken
- ICxTokenFactory
- IERC165
- IERC20
- IERC20Detailed
- IERC20Metadata
- IERC3156FlashBorrower
- IERC3156FlashLender
- IFinalization
- IGovernance
- ILendingStrategy
- ILiquidityEngine
- IMember
- INeptuneRouterV1
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceOracle
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockLiquidityEngineUser
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NeptuneRouterV1
- NPM
- NpmDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- POT
- PriceLibV1
- Processor
- ProtoBase
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- RegistryLibV1
- Reporter
- Resolution
- Resolvable
- RoutineInvokerLibV1
- SafeERC20
- StakingPoolBase
- StakingPoolCoreLibV1
- StakingPoolInfo
- StakingPoolLibV1
- StakingPoolReward
- StakingPools
- Store
- StoreBase
- StoreKeyUtil
- StrategyLibV1
- Strings
- TimelockController
- Unstakable
- ValidationLibV1
- Vault
- VaultBase
- VaultDelegate
- VaultDelegateBase
- VaultDelegateWithFlashLoan
- VaultFactory
- VaultFactoryLibV1
- VaultLibV1
- VaultLiquidity
- VaultStrategy
- WithFlashLoan
- WithPausability
- WithRecovery
- Witness