This repository contains the TrueUSD ERC20 contract and related contracts.
This is a high-level overview of the contracts. For more specifics, see the relevant .sol files.
These contracts are inspired by and roughly equivalent to the corresponding ERC20 token contracts from OpenZeppelin. The main difference is that they keep track of balances and allowances by using separate contracts (BalanceSheet.sol and AllowanceSheet.sol) instead of mappings in their own storage. The ERCevents contract is used to ensure that events are still emitted from the original address even after the TrueUSD contract is delegated.
This makes it easier for users to burn tokens (i.e. redeem them for USD) by treating sends to 0x0 as burn operations.
This limits the minimum and maximum number of tokens that can be burned (redeemed) at once.
If a new version of the TrueUSD contract is ever launched, these three contracts allow users to continue using the old version if they want and it will forward all basic transactions to the new one. See the section entitled Delegation Process below.
This allows for transaction fees.
This is the top-level ERC20 contract tying together all the previously mentioned functionality.
This contract is the initial owner of TrueUSD.sol. Consists of an Owner key, Mint Pause Keys, Mint Key, and Mint Approval Keys. It also imposes time delays on mint requests to maximize security.
This contract is the owner of TimeLockedController.sol. It turns every function that only the owner can access into a multisig function that requires 2/3 approvals.
To delegate calls to new contract, first deploy a contract that implements DelegateBurnable. Configure fees, burn bounds, global pause etc. The contract must also implement setBalanceSheet(address) and setAllowanceSheet(address) in order to claim the storage contracts.
Set registry instance for the new contract. Set totalSupply to equal to the current totalSupply of the old contract.
Transfer ownership of the new contract to TimeLockedController. Claim ownership of new contract with TimeLockedController.
If the new contract has function setDelegatedFrom, call the function with TrueUSD contract address as the parameter.
call delegateToNewContract(_newContractAddress, _balanceSheetAddress, _allowanceSheetAddress) to delegate to new contract.
Initialize the registry submodule in the root directory:
- `git submodule init && git submodule update``
To run the tests and generate a code coverage report:
Exchanges where TrueUSD is Traded