Skip to content

Latest commit

 

History

History
293 lines (253 loc) · 8.62 KB

File metadata and controls

293 lines (253 loc) · 8.62 KB

FaultyCompoundStablecoinDelegator.sol

View Source: contracts/fakes/FaultyCompoundStablecoinDelegator.sol

↗ Extends: ICompoundERC20DelegatorLike, ERC20

FaultyCompoundStablecoinDelegator

Contract Members

Constants & Variables

contract FakeToken public stablecoin;
contract FakeToken public cStablecoin;
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 _stablecoin, FakeToken _cStablecoin, uint256 _returnValue) public nonpayable ERC20 

Arguments

Name Type Description
_stablecoin FakeToken
_cStablecoin FakeToken
_returnValue uint256
Source Code
constructor(
    FakeToken _stablecoin,
    FakeToken _cStablecoin,
    uint256 _returnValue
  ) ERC20("cStablecoin", "cStablecoin") {
    stablecoin = _stablecoin;
    cStablecoin = _cStablecoin;
    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) {
    stablecoin.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) {
    cStablecoin.transferFrom(msg.sender, address(this), redeemTokens);
    return returnValue;
  }

Contracts