diff --git a/contracts/contracts/token/OUSD.sol b/contracts/contracts/token/OUSD.sol index f4fe5f3e57..eac59df1d3 100644 --- a/contracts/contracts/token/OUSD.sol +++ b/contracts/contracts/token/OUSD.sol @@ -91,7 +91,7 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable { * Yield accounting action triggered * * Yield accounting Action - * When a transfer from/to rebaseSrouce or transfer from rebaseReceiver happens all the + * When a transfer from/to rebaseSource or transfer from rebaseReceiver happens all the * delegated yield accruing in the `delegatedRebases` is materialized to * _creditBalances[rebaseReceiver]. The delegatedRebases[rebaseSource]'s * creditsPerToken are updated to the latest global contract value. diff --git a/contracts/docs/OUSDSquashed.svg b/contracts/docs/OUSDSquashed.svg index bf4f7032c0..7b36b5d38d 100644 --- a/contracts/docs/OUSDSquashed.svg +++ b/contracts/docs/OUSDSquashed.svg @@ -4,97 +4,115 @@ - - + + UmlClassDiagram - - + + -186 - -OUSD -../contracts/token/OUSD.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   _____gap: uint256[100] <<InitializableERC20Detailed>> -   _name: string <<InitializableERC20Detailed>> -   _symbol: string <<InitializableERC20Detailed>> -   _decimals: uint8 <<InitializableERC20Detailed>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   MAX_SUPPLY: uint256 <<OUSD>> -   _allowances: mapping(address=>mapping(address=>uint256)) <<OUSD>> -   _creditBalances: mapping(address=>uint256) <<OUSD>> -   _rebasingCredits: uint256 <<OUSD>> -   _rebasingCreditsPerToken: uint256 <<OUSD>> -   RESOLUTION_INCREASE: uint256 <<OUSD>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   _totalSupply: uint256 <<OUSD>> -   vaultAddress: address <<OUSD>> -   nonRebasingSupply: uint256 <<OUSD>> -   nonRebasingCreditsPerToken: mapping(address=>uint256) <<OUSD>> -   rebaseState: mapping(address=>RebaseOptions) <<OUSD>> -   isUpgraded: mapping(address=>uint256) <<OUSD>> - -Internal: -    _initialize(nameArg: string, symbolArg: string, decimalsArg: uint8) <<InitializableERC20Detailed>> -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _executeTransfer(_from: address, _to: address, _value: uint256) <<OUSD>> -    _mint(_account: address, _amount: uint256) <<nonReentrant>> <<OUSD>> -    _burn(_account: address, _amount: uint256) <<nonReentrant>> <<OUSD>> -    _creditsPerToken(_account: address): uint256 <<OUSD>> -    _isNonRebasingAccount(_account: address): bool <<OUSD>> -    _ensureRebasingMigration(_account: address) <<OUSD>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    initialize(_nameArg: string, _symbolArg: string, _vaultAddress: address, _initialCreditsPerToken: uint256) <<onlyGovernor, initializer>> <<OUSD>> -    mint(_account: address, _amount: uint256) <<onlyVault>> <<OUSD>> -    burn(account: address, amount: uint256) <<onlyVault>> <<OUSD>> -    changeSupply(_newTotalSupply: uint256) <<onlyVault, nonReentrant>> <<OUSD>> -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) <<IERC20>> -    <<event>> Approval(owner: address, spender: address, value: uint256) <<IERC20>> -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> TotalSupplyUpdatedHighres(totalSupply: uint256, rebasingCredits: uint256, rebasingCreditsPerToken: uint256) <<OUSD>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<OUSD>> -    totalSupply(): uint256 <<OUSD>> -    balanceOf(_account: address): uint256 <<OUSD>> -    transfer(_to: address, _value: uint256): bool <<OUSD>> -    allowance(_owner: address, _spender: address): uint256 <<OUSD>> -    approve(_spender: address, _value: uint256): bool <<OUSD>> -    transferFrom(_from: address, _to: address, _value: uint256): bool <<OUSD>> -    name(): string <<InitializableERC20Detailed>> -    symbol(): string <<InitializableERC20Detailed>> -    decimals(): uint8 <<InitializableERC20Detailed>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    rebasingCreditsPerToken(): uint256 <<OUSD>> -    rebasingCredits(): uint256 <<OUSD>> -    rebasingCreditsPerTokenHighres(): uint256 <<OUSD>> -    rebasingCreditsHighres(): uint256 <<OUSD>> -    creditsBalanceOf(_account: address): (uint256, uint256) <<OUSD>> -    creditsBalanceOfHighres(_account: address): (uint256, uint256, bool) <<OUSD>> -    increaseAllowance(_spender: address, _addedValue: uint256): bool <<OUSD>> -    decreaseAllowance(_spender: address, _subtractedValue: uint256): bool <<OUSD>> -    rebaseOptIn() <<nonReentrant>> <<OUSD>> -    rebaseOptOut() <<nonReentrant>> <<OUSD>> +228 + +OUSD +../contracts/token/OUSD.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   _____gap: uint256[100] <<InitializableERC20Detailed>> +   _name: string <<InitializableERC20Detailed>> +   _symbol: string <<InitializableERC20Detailed>> +   _decimals: uint8 <<InitializableERC20Detailed>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   MAX_SUPPLY: uint256 <<OUSD>> +   _allowances: mapping(address=>mapping(address=>uint256)) <<OUSD>> +   _creditBalances: mapping(address=>uint256) <<OUSD>> +   _rebasingCredits: uint256 <<OUSD>> +   _rebasingCreditsPerToken: uint256 <<OUSD>> +   delegatedRebases: mapping(address=>RebaseDelegationData) <<OUSD>> +   delegatedRebasesReversed: mapping(address=>RebaseDelegationData) <<OUSD>> +   RESOLUTION_INCREASE: uint256 <<OUSD>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   _totalSupply: uint256 <<OUSD>> +   vaultAddress: address <<OUSD>> +   nonRebasingSupply: uint256 <<OUSD>> +   nonRebasingCreditsPerToken: mapping(address=>uint256) <<OUSD>> +   rebaseState: mapping(address=>RebaseOptions) <<OUSD>> +   isUpgraded: mapping(address=>uint256) <<OUSD>> + +Internal: +    _initialize(nameArg: string, symbolArg: string, decimalsArg: uint8) <<InitializableERC20Detailed>> +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _executeTransfer(_from: address, _to: address, _value: uint256) <<OUSD>> +    _mint(_account: address, _amount: uint256) <<nonReentrant>> <<OUSD>> +    _burn(_account: address, _amount: uint256) <<nonReentrant>> <<OUSD>> +    _creditsPerToken(_account: address): uint256 <<OUSD>> +    _isNonRebasingAccount(_account: address): bool <<OUSD>> +    _ensureRebasingMigration(_account: address) <<OUSD>> +    _rebaseOptIn(_account: address) <<OUSD>> +    _stopDelegateYield(_accountSource: address) <<OUSD>> +    _delegateYield(_accountSource: address, _accountReceiver: address) <<OUSD>> +    _resetYieldDelegation(_accountSource: address, _accountReceiver: address) <<OUSD>> +    _delegatedRebaseAccountingBySource(_accountSource: address) <<OUSD>> +    _delegatedRebaseAccountingByReceiver(_accountReceiver: address) <<OUSD>> +    _delegatedRebaseAccounting(_accountSource: address, _accountReceiver: address, _delegationStartCreditsPerToken: uint256) <<OUSD>> +    _balanceOfRebaseDelegated(_accountReceiver: address): uint256 <<OUSD>> +    _balanceOfRebaseDelegated(_accountSource: address, _delegationStartCreditsPerToken: uint256): uint256 <<OUSD>> +    _hasRebaseDelegatedTo(account: address): bool <<OUSD>> +    _delegatesRebase(account: address): bool <<OUSD>> +External: +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_nameArg: string, _symbolArg: string, _vaultAddress: address, _initialCreditsPerToken: uint256) <<onlyGovernor, initializer>> <<OUSD>> +    mint(_account: address, _amount: uint256) <<onlyVault>> <<OUSD>> +    burn(account: address, amount: uint256) <<onlyVault>> <<OUSD>> +    changeSupply(_newTotalSupply: uint256) <<onlyVault, nonReentrant>> <<OUSD>> +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) <<IERC20>> +    <<event>> Approval(owner: address, spender: address, value: uint256) <<IERC20>> +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> TotalSupplyUpdatedHighres(totalSupply: uint256, rebasingCredits: uint256, rebasingCreditsPerToken: uint256) <<OUSD>> +    <<event>> AccountRebasingEnabled(account: address) <<OUSD>> +    <<event>> AccountRebasingDisabled(account: address) <<OUSD>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<OUSD>> +    totalSupply(): uint256 <<OUSD>> +    balanceOf(_account: address): uint256 <<OUSD>> +    transfer(_to: address, _value: uint256): bool <<OUSD>> +    allowance(_owner: address, _spender: address): uint256 <<OUSD>> +    approve(_spender: address, _value: uint256): bool <<OUSD>> +    transferFrom(_from: address, _to: address, _value: uint256): bool <<OUSD>> +    name(): string <<InitializableERC20Detailed>> +    symbol(): string <<InitializableERC20Detailed>> +    decimals(): uint8 <<InitializableERC20Detailed>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    rebasingCreditsPerToken(): uint256 <<OUSD>> +    rebasingCredits(): uint256 <<OUSD>> +    rebasingCreditsPerTokenHighres(): uint256 <<OUSD>> +    rebasingCreditsHighres(): uint256 <<OUSD>> +    creditsBalanceOf(_account: address): (uint256, uint256) <<OUSD>> +    creditsBalanceOfHighres(_account: address): (uint256, uint256, bool) <<OUSD>> +    increaseAllowance(_spender: address, _addedValue: uint256): bool <<OUSD>> +    decreaseAllowance(_spender: address, _subtractedValue: uint256): bool <<OUSD>> +    governanceRebaseOptIn(_account: address) <<nonReentrant, onlyGovernor>> <<OUSD>> +    rebaseOptIn() <<nonReentrant>> <<OUSD>> +    rebaseOptOut() <<nonReentrant>> <<OUSD>> +    governanceDelegateYield(_accountSource: address, _accountReceiver: address) <<onlyGovernor>> <<OUSD>> +    governanceStopYieldDelegation(_accountSource: address) <<onlyGovernor>> <<OUSD>> diff --git a/contracts/test/token/ousd.js b/contracts/test/token/ousd.js index 48ac233cb1..c8273a4bcb 100644 --- a/contracts/test/token/ousd.js +++ b/contracts/test/token/ousd.js @@ -850,7 +850,7 @@ describe("Token", function () { await checkTransferOut(9); }); - it.only("Should delegate rebase to another account", async () => { + it("Should delegate rebase to another account", async () => { let { ousd, vault, matt, josh, anna, usdc, governor } = fixture; await ousd.connect(matt).transfer(anna.address, ousdUnits("10")); @@ -881,7 +881,7 @@ describe("Token", function () { await expect(anna).has.an.balanceOf("90", ousd); }); - it.only("Should delegate rebase to another account initially having 0 balance", async () => { + it("Should delegate rebase to another account initially having 0 balance", async () => { let { ousd, vault, matt, josh, anna, usdc, governor } = fixture; await expect(josh).has.an.approxBalanceOf("100.00", ousd);