Skip to content

Latest commit

 

History

History
326 lines (287 loc) · 11.1 KB

AdvancedTokenStorage.md

File metadata and controls

326 lines (287 loc) · 11.1 KB

Advanced Token Storage contract. (AdvancedTokenStorage.sol)

View Source: contracts/connectors/loantoken/AdvancedTokenStorage.sol

↗ Extends: LoanTokenBase ↘ Derived Contracts: AdvancedToken, ILoanTokenLogicBeacon, LoanToken, LoanTokenLogicProxy, PreviousLoanToken, PreviousLoanTokenSettingsLowerAdmin

AdvancedTokenStorage contract

This contract code comes from bZx. bZx is a protocol for tokenized margin trading and lending https://bzx.network similar to the dYdX protocol.

  • AdvancedTokenStorage implements standard ERC-20 getters functionality: totalSupply, balanceOf, allowance and some events. iToken logic is divided into several contracts AdvancedToken, AdvancedTokenStorage and LoanTokenBase.

Contract Members

Constants & Variables

mapping(address => uint256) internal balances;
mapping(address => mapping(address => uint256)) internal allowed;
uint256 internal totalSupply_;

Events

event Transfer(address indexed from, address indexed to, uint256  value);
event Approval(address indexed owner, address indexed spender, uint256  value);
event AllowanceUpdate(address indexed owner, address indexed spender, uint256  valueBefore, uint256  valueAfter);
event Mint(address indexed minter, uint256  tokenAmount, uint256  assetAmount, uint256  price);
event Burn(address indexed burner, uint256  tokenAmount, uint256  assetAmount, uint256  price);
event FlashBorrow(address  borrower, address  target, address  loanToken, uint256  loanAmount);

Functions


totalSupply

Get the total supply of iTokens.

function totalSupply() public view
returns(uint256)
Source Code
function totalSupply() public view returns (uint256) {
        return totalSupply_;
    }

balanceOf

Get the amount of iTokens owned by an account.

function balanceOf(address _owner) public view
returns(uint256)

Arguments

Name Type Description
_owner address The account owner of the iTokens.

Returns

The number of iTokens an account owns.

Source Code
function balanceOf(address _owner) public view returns (uint256) {
        return balances[_owner];
    }

allowance

Get the amount of iTokens allowed to be spent by a given account on behalf of the owner.

function allowance(address _owner, address _spender) public view
returns(uint256)

Arguments

Name Type Description
_owner address The account owner of the iTokens.
_spender address The account allowed to send the iTokens.

Returns

The number of iTokens an account is allowing the spender to send on its behalf.

Source Code
function allowance(address _owner, address _spender) public view returns (uint256) {
        return allowed[_owner][_spender];
    }

Contracts