Dai Module
The DAI token contract and all of the adapters DaiJoin adapters.
- Module Name: DAI Module
- Type/Category: Proxy —> Dai.sol and DaiJoin.sol
The origin of DAI was designed to represent any token that the core system considers equal in value to its internal debt unit. Thus, the DAI Module contains the DAI token contract and all of the adapters DaiJoin adapters.
Key Functionalities (as defined in the smart contract)
Mint
- Mint to an addressBurn
- Burn at an addressPush
- TransferPull
- Transfer FromMove
- Transfer FromApprove
- Allow pulls and movesPermit
- Approve by signatureOther
name
- Dai Stablecoinsymbol
- DAIversion
- 1decimals
- 18totalSupply
- Total DAI SupplybalanceOf(usr: address)
- User balanceallowance(src: address, dst: address)
- Approvalsnonces(usr: address)
- Permit noncevat
- storage of the Vat’s addressilk
- id of the Ilk for which aGemJoin
is created forgem
- the address of theilk
for transferringdai
- the address of thedai
tokenone
- a 10^27 uint used for math inDaiJoin
- 2.
The
Dai
contract is the user facing ERC20 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.Join
consists of three smart contracts, one of which is the DaiJoin contract. Each join contract is created specifically to allow the given token type to be joined to the vat. Because of this, each join contract has slightly different logic to account for the different types of tokens within the system. The DaiJoin contract allows users to withdraw their Dai from the system into a standard ERC20 token.DAI
is also susceptible to the known ERC20 race condition, but should not normally be an issue with unlimited approval. We recommend any users using theapproval
for a specific amount be aware of this particular issue and use caution when authorizing other contracts to perform transfers on their behalf.- There are limited sources of user error in the
join
contracts system due to the limited functionality of the system. Barring a contract bug, should a user call join by accident they could always get their tokens back through the corresponding exit call on the given join contract. The main issue to be aware of here would be a well-executed phishing attack. As the system evolves and potentially more join contracts are created, or more user interfaces are made, there is the potential for a user to have their funds stolen by a malicious join contract which does not actually send tokens to the vat, but instead to some other contract or wallet.
There could potentially be a
vat
upgrade that would require new join
contracts to be created.If a
gem
contract were to go through a token upgrade or have the tokens frozen while a user's collateral was in the system, there could potentially be a scenario in which the users were unable to redeem their collateral after the freeze or upgrade was finished. This seems to be a small risk though because it would seem likely that the token going through this upgrade would want to work alongside the maker community to be sure this was not an issue.Last modified 3yr ago