Skip to content

Commit

Permalink
Implement CWrappedNativeDelegator
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyHD committed Mar 31, 2021
1 parent 9231ae3 commit dac84d1
Show file tree
Hide file tree
Showing 2 changed files with 532 additions and 0 deletions.
50 changes: 50 additions & 0 deletions contracts/CCapableWrappedNativeDelegate.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
pragma solidity ^0.5.16;

import "./CCapableErc20.sol";

/**
* @title Compound's CCapableWrappedNativeDelegate Contract
* @notice CTokens which wrap an EIP-20 underlying and are delegated to
* @author Compound
*/
contract CCapableWrappedNativeDelegate is CCapableErc20 {
/**
* @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();
}

/**
* @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");
}

function () external payable {
require(msg.value == 0,"CCapableWrappedNativeDelegate: not implemented yet");
}
}
Loading

0 comments on commit dac84d1

Please sign in to comment.