Skip to content

Commit

Permalink
Merge pull request #143 from CreamFi/enhance_crAmp
Browse files Browse the repository at this point in the history
Enhance cr amp
  • Loading branch information
bun919tw authored Oct 8, 2021
2 parents 7c1bb78 + 1b80ad0 commit 78ed154
Show file tree
Hide file tree
Showing 8 changed files with 2,429 additions and 17 deletions.
812 changes: 812 additions & 0 deletions contracts/CCollateralCapErc20CheckRepay.sol

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions contracts/CCollateralCapErc20CheckRepayDelegate.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pragma solidity ^0.5.16;

import "./CCollateralCapErc20CheckRepay.sol";

/**
* @title Cream's CCollateralCapErc20CheckRepayDelegate Contract
* @notice CTokens which wrap an EIP-20 underlying and are delegated to
* @author Cream
*/
contract CCollateralCapErc20CheckRepayDelegate is CCollateralCapErc20CheckRepay {
/**
* @notice Construct an empty delegate
*/
constructor() public {}

/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeImplementation(bytes memory data) public {
// Shh -- currently unused
data;

// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}

require(msg.sender == admin, "only the admin may call _becomeImplementation");

// Set internal cash when becoming implementation
internalCash = getCashOnChain();

// Set CToken version in comptroller
ComptrollerInterfaceExtension(address(comptroller)).updateCTokenVersion(
address(this),
ComptrollerV2Storage.Version.COLLATERALCAP
);
}

/**
* @notice Called by the delegator on a delegate to forfeit its responsibility
*/
function _resignImplementation() public {
// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}

require(msg.sender == admin, "only the admin may call _resignImplementation");
}
}
Loading

0 comments on commit 78ed154

Please sign in to comment.