Skip to content

Commit

Permalink
contracts/: fix cToken storage collision problem
Browse files Browse the repository at this point in the history
  • Loading branch information
bun919tw committed Jan 20, 2021
1 parent 4ede85b commit 070077a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/CErc20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "./CToken.sol";
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
contract CErc20 is CToken, CErc20Interface, CErc20StorageExtension {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
Expand Down
16 changes: 8 additions & 8 deletions contracts/CTokenInterfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,6 @@ contract CErc20Storage {
* @notice Underlying asset for this CToken
*/
address public underlying;

/**
* @notice Internal cash counter for this CToken. Should equal underlying.balanceOf(address(this)) for CERC20.
*/
uint256 public internalCash;
}

contract CErc20Interface is CErc20Storage {
Expand All @@ -270,14 +265,19 @@ contract CErc20Interface is CErc20Storage {
function _addReserves(uint addAmount) external returns (uint);
}

contract CDelegationStorage {
contract CErc20StorageExtension {
/**
* @notice Implementation address for this contract
*/
address public implementation;

/**
* @notice Internal cash counter for this CToken. Should equal underlying.balanceOf(address(this)) for CERC20.
*/
uint256 public internalCash;
}

contract CDelegatorInterface is CDelegationStorage {
contract CDelegatorInterface is CErc20StorageExtension {
/**
* @notice Emitted when implementation is changed
*/
Expand All @@ -292,7 +292,7 @@ contract CDelegatorInterface is CDelegationStorage {
function _setImplementation(address implementation_, bool allowResign, bytes memory becomeImplementationData) public;
}

contract CDelegateInterface is CDelegationStorage {
contract CDelegateInterface is CErc20StorageExtension {
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @dev Should revert if any issues arise which make it unfit for delegation
Expand Down

0 comments on commit 070077a

Please sign in to comment.