Blockwell

LUSD Stablecoin

ERC20

This contract is an ERC20 token.

Name LUSD Stablecoin
Symbol LUSD
Decimals 18
Total Supply 478,480,041 LUSD

About link description

Liquity USD (LUSD) is a cryptocurrency and operates on the Ethereum platform. Liquity USD has a current supply of 719,446,094.8060437. The last known price of Liquity USD is 1.00689868 USD and is up 0.30 over the last 24 hours. It is currently trading on 10 active market(s) with $866,803.88 traded over the last 24 hours. More information can be found at https://www.liquity.org/.

Stats

Public Functions 20
Event Types 6
Code Size 100,869 bytes

Library Use

Uses SafeMath for uint256.

Events (6) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

BorrowerOperationsAddressChanged Event

Parameters help
_newBorrowerOperationsAddress
address help

LUSDTokenBalanceUpdated Event

Parameters help
_user
address help
_amount
uint help

StabilityPoolAddressChanged Event

Parameters help
_newStabilityPoolAddress
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

TroveManagerAddressChanged Event

Parameters help
_troveManagerAddress
address help

_NAME Constant

string help
LUSD Stablecoin

_SYMBOL Constant

string help
LUSD

_VERSION Constant

string help
1

_DECIMALS Constant

uint8 help
18

_PERMIT_TYPEHASH Constant

bytes32 help
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9

_TYPE_HASH Constant

bytes32 help
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f

troveManagerAddress Variable

address help

stabilityPoolAddress Variable

address help

borrowerOperationsAddress Variable

address help

_totalSupply Variable

uint256 help
Internal Variable

_CACHED_DOMAIN_SEPARATOR Variable

bytes32 help
Internal Variable

_CACHED_CHAIN_ID Variable

uint256 help
Internal Variable

_HASHED_NAME Variable

bytes32 help
Internal Variable

_HASHED_VERSION Variable

bytes32 help
Internal Variable

_nonces Variable

mapping(address => uint256) help
Internal Variable

_balances Variable

mapping(address => uint256) help
Internal Variable

_allowances Variable

mapping(address => mapping(address => uint256)) help
Internal Variable

Functions Expand All Collapse All

mint keyboard_arrow_up

Parameters help

Name Type
_account
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function mint(address _account, uint256 _amount) external override {
  _requireCallerIsBorrowerOperations();
  _mint(_account, _amount);
}

burn keyboard_arrow_up

Parameters help

Name Type
_account
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function burn(address _account, uint256 _amount) external override {
  _requireCallerIsBOorTroveMorSP();
  _burn(_account, _amount);
}

sendToPool keyboard_arrow_up

Parameters help

Name Type
_sender
address help
_poolAddress
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function sendToPool(
  address _sender,
  address _poolAddress,
  uint256 _amount
) external override {
  _requireCallerIsStabilityPool();
  _transfer(_sender, _poolAddress, _amount);
}

returnFromPool keyboard_arrow_up

Parameters help

Name Type
_poolAddress
address help
_receiver
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function returnFromPool(
  address _poolAddress,
  address _receiver,
  uint256 _amount
) external override {
  _requireCallerIsTroveMorSP();
  _transfer(_poolAddress, _receiver, _amount);
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() external view override returns (uint256) {
  return _totalSupply;
}

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address account) external view override returns (uint256) {
  return _balances[account];
}

Parameters help

Name Type
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transfer(address recipient, uint256 amount)
  external
  override
  returns (bool)
{
  _requireValidRecipient(recipient);
  _transfer(msg.sender, recipient, amount);
  return true;
}

Parameters help

Name Type
owner
address help
spender
address help

Properties

Visibility help public
Mutability help view
Source Code
function allowance(address owner, address spender)
  external
  view
  override
  returns (uint256)
{
  return _allowances[owner][spender];
}

Parameters help

Name Type
spender
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function approve(address spender, uint256 amount)
  external
  override
  returns (bool)
{
  _approve(msg.sender, spender, amount);
  return true;
}

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferFrom(
  address sender,
  address recipient,
  uint256 amount
) external override returns (bool) {
  _requireValidRecipient(recipient);
  _transfer(sender, recipient, amount);
  _approve(
    sender,
    msg.sender,
    _allowances[sender][msg.sender].sub(
      amount,
      "ERC20: transfer amount exceeds allowance"
    )
  );
  return true;
}

Parameters help

Name Type
spender
address help
addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function increaseAllowance(address spender, uint256 addedValue)
  external
  override
  returns (bool)
{
  _approve(
    msg.sender,
    spender,
    _allowances[msg.sender][spender].add(addedValue)
  );
  return true;
}

Parameters help

Name Type
spender
address help
subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  external
  override
  returns (bool)
{
  _approve(
    msg.sender,
    spender,
    _allowances[msg.sender][spender].sub(
      subtractedValue,
      "ERC20: decreased allowance below zero"
    )
  );
  return true;
}

domainSeparator keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function domainSeparator() public view override returns (bytes32) {
  if (_chainID() == _CACHED_CHAIN_ID) {
    return _CACHED_DOMAIN_SEPARATOR;
  } else {
    return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
  }
}

permit keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
amount
uint help
deadline
uint help
v
uint8 help
r
bytes32 help
s
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function permit(
  address owner,
  address spender,
  uint256 amount,
  uint256 deadline,
  uint8 v,
  bytes32 r,
  bytes32 s
) external override {
  require(deadline >= now, "LUSD: expired deadline");
  bytes32 digest = keccak256(
    abi.encodePacked(
      "\x19\x01",
      domainSeparator(),
      keccak256(
        abi.encode(
          _PERMIT_TYPEHASH,
          owner,
          spender,
          amount,
          _nonces[owner]++,
          deadline
        )
      )
    )
  );
  address recoveredAddress = ecrecover(digest, v, r, s);
  require(recoveredAddress == owner, "LUSD: invalid signature");
  _approve(owner, spender, amount);
}

nonces keyboard_arrow_up

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function nonces(address owner) external view override returns (uint256) {
  // FOR EIP 2612
  return _nonces[owner];
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function name() external view override returns (string memory) {
  return _NAME;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function symbol() external view override returns (string memory) {
  return _SYMBOL;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function decimals() external view override returns (uint8) {
  return _DECIMALS;
}

version keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function version() external view override returns (string memory) {
  return _VERSION;
}

permitTypeHash keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function permitTypeHash() external view override returns (bytes32) {
  return _PERMIT_TYPEHASH;
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal LUSDToken._chainID keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help pure
Source Code
function _chainID() private pure returns (uint256 chainID) {
  assembly {
    chainID := chainid()
  }
}

internal LUSDToken._buildDomainSeparator keyboard_arrow_up

Parameters help

Name Type
typeHash
bytes32 help
name
bytes32 help
version
bytes32 help

Properties

Visibility help private
Mutability help view
Source Code
function _buildDomainSeparator(
  bytes32 typeHash,
  bytes32 name,
  bytes32 version
) private view returns (bytes32) {
  return
    keccak256(abi.encode(typeHash, name, version, _chainID(), address(this)));
}

internal LUSDToken._transfer keyboard_arrow_up

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transfer(
  address sender,
  address recipient,
  uint256 amount
) internal {
  assert(sender != address(0));
  assert(recipient != address(0));

  _balances[sender] = _balances[sender].sub(
    amount,
    "ERC20: transfer amount exceeds balance"
  );
  _balances[recipient] = _balances[recipient].add(amount);
  emit Transfer(sender, recipient, amount);
}

internal LUSDToken._mint keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _mint(address account, uint256 amount) internal {
  assert(account != address(0));

  _totalSupply = _totalSupply.add(amount);
  _balances[account] = _balances[account].add(amount);
  emit Transfer(address(0), account, amount);
}

internal LUSDToken._burn keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _burn(address account, uint256 amount) internal {
  assert(account != address(0));

  _balances[account] = _balances[account].sub(
    amount,
    "ERC20: burn amount exceeds balance"
  );
  _totalSupply = _totalSupply.sub(amount);
  emit Transfer(account, address(0), amount);
}

internal LUSDToken._approve keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _approve(
  address owner,
  address spender,
  uint256 amount
) internal {
  assert(owner != address(0));
  assert(spender != address(0));

  _allowances[owner][spender] = amount;
  emit Approval(owner, spender, amount);
}

internal LUSDToken._requireValidRecipient keyboard_arrow_up

Parameters help

Name Type
_recipient
address help

Properties

Visibility help internal
Mutability help view

Requirements help

Source Code
function _requireValidRecipient(address _recipient) internal view {
  require(
    _recipient != address(0) && _recipient != address(this),
    "LUSD: Cannot transfer tokens directly to the LUSD token contract or the zero address"
  );
  require(
    _recipient != stabilityPoolAddress &&
      _recipient != troveManagerAddress &&
      _recipient != borrowerOperationsAddress,
    "LUSD: Cannot transfer tokens directly to the StabilityPool, TroveManager or BorrowerOps"
  );
}

internal LUSDToken._requireCallerIsBorrowerOperations keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _requireCallerIsBorrowerOperations() internal view {
  require(
    msg.sender == borrowerOperationsAddress,
    "LUSDToken: Caller is not BorrowerOperations"
  );
}

internal LUSDToken._requireCallerIsBOorTroveMorSP keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _requireCallerIsBOorTroveMorSP() internal view {
  require(
    msg.sender == borrowerOperationsAddress ||
      msg.sender == troveManagerAddress ||
      msg.sender == stabilityPoolAddress,
    "LUSD: Caller is neither BorrowerOperations nor TroveManager nor StabilityPool"
  );
}

internal LUSDToken._requireCallerIsStabilityPool keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _requireCallerIsStabilityPool() internal view {
  require(
    msg.sender == stabilityPoolAddress,
    "LUSD: Caller is not the StabilityPool"
  );
}

internal LUSDToken._requireCallerIsTroveMorSP keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _requireCallerIsTroveMorSP() internal view {
  require(
    msg.sender == troveManagerAddress || msg.sender == stabilityPoolAddress,
    "LUSD: Caller is neither TroveManager nor StabilityPool"
  );
}

internal CheckContract.checkContract keyboard_arrow_up

Parameters help

Name Type
_account
address help

Properties

Visibility help internal
Mutability help view

Requirements help

Source Code
function checkContract(address _account) internal view {
  require(_account != address(0), "Account cannot be zero address");

  uint256 size;
  // solhint-disable-next-line no-inline-assembly
  assembly {
    size := extcodesize(_account)
  }
  require(size > 0, "Account code size cannot be zero");
}