Dai
contract is the user-facing ERC20 token contract maintaining the accounting for external Dai balances. Most functions are standard for a token with changing supply, but it also notably features the ability to issue approvals for transfers based on signed messages.Mint
- Mint to an addressBurn
- Burn at an addressPush
- TransferPull
- Transfer FromMove
- Transfer FromApprove
- Allow pulls and movesPermit
- Approve by signaturename
- Dai Stablecoinsymbol
- DAIversion
- 1decimals
- 18totalSupply
- Total DAI SupplybalanceOf(usr: address)
- User balanceallowance(src: address, dst: address)
- Approvalsnonces(usr: address)
- Permit noncewad
- fixed point decimal with 18 decimals (for basic quantities, e.g. balances).dai.sol
functions as a typical ERC20 token. These tokens have been already been heavily documented here and it is recommended to read through that documentation for the core functions of an ERC20 token.transferFrom
in the DAI contract works in a slightly different form than the generic transferFrom
function. The DAI contract allows for "unlimited approval". Should the user approve an address for the maximum uint256 value, then that address will have unlimited approval until told otherwise.push
, pull
& move
are aliases for transferFrom
calls in the form of transferFrom(msg.sender, usr, amount)
, transferFrom(usr, msg.sender, amount)
& transferFrom(src, dst, amount)
.permit
is a signature-based approval function. This allows for an end-user to sign a message which can then be relayed by another party to submit their approval. This can be useful for applications in which the end-user does not need to hold ETH
.holder
, spender
, nonce
, expiry
and the allowed
amount. This can then be submitted to Permit()
to update the user's approval.approval
for a specific amount be aware of this particular issue and use caution when authorizing other contracts to perform transfers on their behalf.transferFrom
functionality: If the src == msg.sender
the function does not require approval
first and treats it as a normal transfer
from the msg.sender
to the dst
.