Skip to content

Latest commit

 

History

History
293 lines (253 loc) · 8.44 KB

FaultyCompoundDaiDelegator.md

File metadata and controls

293 lines (253 loc) · 8.44 KB

FaultyCompoundDaiDelegator.sol

View Source: contracts/fakes/FaultyCompoundDaiDelegator.sol

↗ Extends: ICompoundERC20DelegatorLike, ERC20

FaultyCompoundDaiDelegator

Contract Members

Constants & Variables

contract FakeToken public dai;
contract FakeToken public cDai;
uint256 public returnValue;

Functions

setReturnValue

function setReturnValue(uint256 _returnValue) external nonpayable

Arguments

Name Type Description
_returnValue uint256
Source Code
function setReturnValue(uint256 _returnValue) external {
    returnValue = _returnValue;
  }

function (FakeToken _dai, FakeToken _cDai, uint256 _returnValue) public nonpayable ERC20 

Arguments

Name Type Description
_dai FakeToken
_cDai FakeToken
_returnValue uint256
Source Code
constructor(
    FakeToken _dai,
    FakeToken _cDai,
    uint256 _returnValue
  ) ERC20("cDAI", "cDAI") {
    dai = _dai;
    cDai = _cDai;
    returnValue = _returnValue;
  }

mint

Sender supplies assets into the market and receives cTokens in exchange

function mint(uint256 mintAmount) external nonpayable
returns(uint256)

Arguments

Name Type Description
mintAmount uint256 The amount of the underlying asset to supply

Returns

uint 0=success, otherwise a failure (see ErrorReporter.sol for details)

Source Code
function mint(uint256 mintAmount) external override returns (uint256) {
    dai.transferFrom(msg.sender, address(this), mintAmount);
    return returnValue;
  }

redeem

Sender redeems cTokens in exchange for the underlying asset

function redeem(uint256 redeemTokens) external nonpayable
returns(uint256)

Arguments

Name Type Description
redeemTokens uint256 The number of cTokens to redeem into underlying

Returns

uint 0=success, otherwise a failure (see ErrorReporter.sol for details)

Source Code
function redeem(uint256 redeemTokens) external override returns (uint256) {
    cDai.transferFrom(msg.sender, address(this), redeemTokens);
    return returnValue;
  }

Contracts