@@ -14,20 +14,47 @@ contract OUSD is Governable {
1414 using SafeCast for int256 ;
1515 using SafeCast for uint256 ;
1616
17+ /// @dev Event triggered when the supply changes
18+ /// @param totalSupply Updated token total supply
19+ /// @param rebasingCredits Updated token rebasing credits
20+ /// @param rebasingCreditsPerToken Updated token rebasing credits per token
1721 event TotalSupplyUpdatedHighres (
1822 uint256 totalSupply ,
1923 uint256 rebasingCredits ,
2024 uint256 rebasingCreditsPerToken
2125 );
26+ /// @dev Event triggered when an account opts in for rebasing
27+ /// @param account Address of the account
2228 event AccountRebasingEnabled (address account );
29+ /// @dev Event triggered when an account opts out of rebasing
30+ /// @param account Address of the account
2331 event AccountRebasingDisabled (address account );
32+ /// @dev Emitted when `value` tokens are moved from one account `from` to
33+ /// another `to`.
34+ /// @param from Address of the account tokens are moved from
35+ /// @param to Address of the account tokens are moved to
36+ /// @param value Amount of tokens transferred
2437 event Transfer (address indexed from , address indexed to , uint256 value );
38+ /// @dev Emitted when the allowance of a `spender` for an `owner` is set by
39+ /// a call to {approve}. `value` is the new allowance.
40+ /// @param owner Address of the owner approving allowance
41+ /// @param spender Address of the spender allowance is granted to
42+ /// @param value Amount of tokens spender can transfer
2543 event Approval (
2644 address indexed owner ,
2745 address indexed spender ,
2846 uint256 value
2947 );
48+ /// @dev Yield resulting from {changeSupply} that a `source` account would
49+ /// receive is directed to `target` account.
50+ /// @param source Address of the source forwarding the yield
51+ /// @param target Address of the target receiving the yield
3052 event YieldDelegated (address source , address target );
53+ /// @dev Yield delegation from `source` account to the `target` account is
54+ /// suspended.
55+ /// @param source Address of the source suspending yield forwarding
56+ /// @param target Address of the target no longer receiving yield from `source`
57+ /// account
3158 event YieldUndelegated (address source , address target );
3259
3360 enum RebaseOptions {
@@ -40,23 +67,39 @@ contract OUSD is Governable {
4067
4168 uint256 [154 ] private _gap; // Slots to align with deployed contract
4269 uint256 private constant MAX_SUPPLY = type (uint128 ).max;
70+ /// @dev The amount of tokens in existence
4371 uint256 public totalSupply;
4472 mapping (address => mapping (address => uint256 )) private allowances;
73+ /// @dev The vault with privileges to execute {mint}, {burn}
74+ /// and {changeSupply}
4575 address public vaultAddress;
4676 mapping (address => uint256 ) internal creditBalances;
4777 // the 2 storage variables below need trailing underscores to not name collide with public functions
4878 uint256 private rebasingCredits_; // Sum of all rebasing credits (creditBalances for rebasing accounts)
4979 uint256 private rebasingCreditsPerToken_;
50- uint256 public nonRebasingSupply; // All nonrebasing balances
80+ /// @dev The amount of tokens that are not rebasing - receiving yield
81+ uint256 public nonRebasingSupply;
5182 mapping (address => uint256 ) internal alternativeCreditsPerToken;
83+ /// @dev A map of all addresses and their respective RebaseOptions
5284 mapping (address => RebaseOptions) public rebaseState;
5385 mapping (address => uint256 ) private __deprecated_isUpgraded;
86+ /// @dev A map of addresses that have yields forwarded to. This is an
87+ /// inverse mapping of {yieldFrom}
88+ /// Key Account forwarding yield
89+ /// Value Account receiving yield
5490 mapping (address => address ) public yieldTo;
91+ /// @dev A map of addresses that are receiving the yield. This is an
92+ /// inverse mapping of {yieldTo}
93+ /// Key Account receiving yield
94+ /// Value Account forwarding yield
5595 mapping (address => address ) public yieldFrom;
5696
5797 uint256 private constant RESOLUTION_INCREASE = 1e9 ;
5898 uint256 [34 ] private __gap; // including below gap totals up to 200
5999
100+ /// @dev Initializes the contract and sets necessary variables.
101+ /// @param _vaultAddress Address of the vault contract
102+ /// @param _initialCreditsPerToken The starting rebasing credits per token.
60103 function initialize (address _vaultAddress , uint256 _initialCreditsPerToken )
61104 external
62105 onlyGovernor
@@ -68,14 +111,18 @@ contract OUSD is Governable {
68111 vaultAddress = _vaultAddress;
69112 }
70113
114+ /// @dev Returns the symbol of the token, a shorter version
115+ /// of the name.
71116 function symbol () external pure virtual returns (string memory ) {
72117 return "OUSD " ;
73118 }
74119
120+ /// @dev Returns the name of the token.
75121 function name () external pure virtual returns (string memory ) {
76122 return "Origin Dollar " ;
77123 }
78124
125+ /// @dev Returns the number of decimals used to get its user representation.
79126 function decimals () external pure virtual returns (uint8 ) {
80127 return 18 ;
81128 }
0 commit comments