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
Constants (6) keyboard_arrow_up
_PERMIT_TYPEHASH Constant
bytes32 help
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9
State Variables (11) keyboard_arrow_up
Functions
mint keyboard_arrow_up
Requirements help
Source Code
function mint(address _account, uint256 _amount) external override {
_requireCallerIsBorrowerOperations();
_mint(_account, _amount);
}
burn keyboard_arrow_up
Requirements help
One or more of the following:
-
stabilityPoolAddress
must be equal to
the sender's address
- OR
troveManagerAddress
must be equal to
the sender's address
- OR
borrowerOperationsAddress
must be equal to
the sender's address
Source Code
function burn(address _account, uint256 _amount) external override {
_requireCallerIsBOorTroveMorSP();
_burn(_account, _amount);
}
sendToPool keyboard_arrow_up
Requirements help
Source Code
function sendToPool(
address _sender,
address _poolAddress,
uint256 _amount
) external override {
_requireCallerIsStabilityPool();
_transfer(_sender, _poolAddress, _amount);
}
returnFromPool keyboard_arrow_up
Requirements help
One or more of the following:
-
stabilityPoolAddress
must be equal to
the sender's address
- OR
troveManagerAddress
must be equal to
the sender's address
Source Code
function returnFromPool(
address _poolAddress,
address _receiver,
uint256 _amount
) external override {
_requireCallerIsTroveMorSP();
_transfer(_poolAddress, _receiver, _amount);
}
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
Source Code
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
_requireValidRecipient(recipient);
_transfer(msg.sender, recipient, amount);
return true;
}
allowance keyboard_arrow_up
approve keyboard_arrow_up
Requirements help
Source Code
function approve(address spender, uint256 amount)
external
override
returns (bool)
{
_approve(msg.sender, spender, amount);
return true;
}
transferFrom keyboard_arrow_up
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;
}
increaseAllowance keyboard_arrow_up
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;
}
decreaseAllowance keyboard_arrow_up
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.
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
Requirements help
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
name keyboard_arrow_up
symbol keyboard_arrow_up
decimals keyboard_arrow_up
version keyboard_arrow_up
Internal Functions
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
internal LUSDToken._buildDomainSeparator keyboard_arrow_up
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
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
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
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
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
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
internal LUSDToken._requireCallerIsBOorTroveMorSP keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
One or more of the following:
-
stabilityPoolAddress
must be equal to
the sender's address
- OR
troveManagerAddress
must be equal to
the sender's address
- OR
borrowerOperationsAddress
must be equal to
the sender's address
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
internal LUSDToken._requireCallerIsTroveMorSP keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
One or more of the following:
-
stabilityPoolAddress
must be equal to
the sender's address
- OR
troveManagerAddress
must be equal to
the sender's address
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
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");
}