forked from compound-finance/compound-protocol
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathCCollateralCapErc20Delegate.sol
49 lines (40 loc) · 1.5 KB
/
CCollateralCapErc20Delegate.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pragma solidity ^0.5.16;
import "./CCollateralCapErc20.sol";
/**
* @title Cream's CCollateralCapErc20Delegate Contract
* @notice CTokens which wrap an EIP-20 underlying and are delegated to
* @author Cream
*/
contract CCollateralCapErc20Delegate is CCollateralCapErc20 {
/**
* @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");
}
}