View Source: contracts/fakes/FakeCompoundDaiDelegator.sol
↗ Extends: ICompoundERC20DelegatorLike, ERC20
FakeCompoundDaiDelegator
Constants & Variables
contract FakeToken public dai;
contract FakeToken public cDai;
function (FakeToken _dai, FakeToken _cDai) public nonpayable ERC20
Arguments
Name | Type | Description |
---|---|---|
_dai | FakeToken | |
_cDai | FakeToken |
Source Code
constructor(FakeToken _dai, FakeToken _cDai) ERC20("cDAI", "cDAI") {
dai = _dai;
cDai = _cDai;
}
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);
cDai.mint(mintAmount);
cDai.transfer(msg.sender, mintAmount);
return 0;
}
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);
uint256 interest = (redeemTokens * 3) / 100;
dai.mint(interest);
dai.transfer(msg.sender, redeemTokens + interest);
return 0;
}
- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundDaiDelegator
- FakePriceOracle
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundDaiDelegator
- Finalization
- ForceEther
- Governance
- GovernanceUtilV1
- IAaveV2LendingPoolLike
- IAccessControl
- IBondPool
- IClaimsProcessor
- ICompoundERC20DelegatorLike
- ICover
- ICoverReassurance
- ICoverStake
- ICxToken
- ICxTokenFactory
- IERC165
- IERC20
- IERC20Detailed
- IERC20Metadata
- IERC3156FlashBorrower
- IERC3156FlashLender
- IFinalization
- IGovernance
- ILendingStrategy
- ILiquidityEngine
- IMember
- INeptuneRouterV1
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceOracle
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockLiquidityEngineUser
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NeptuneRouterV1
- NPM
- NpmDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- POT
- PriceLibV1
- Processor
- ProtoBase
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- RegistryLibV1
- Reporter
- Resolution
- Resolvable
- RoutineInvokerLibV1
- SafeERC20
- StakingPoolBase
- StakingPoolCoreLibV1
- StakingPoolInfo
- StakingPoolLibV1
- StakingPoolReward
- StakingPools
- Store
- StoreBase
- StoreKeyUtil
- StrategyLibV1
- Strings
- TimelockController
- Unstakable
- ValidationLibV1
- Vault
- VaultBase
- VaultDelegate
- VaultDelegateBase
- VaultDelegateWithFlashLoan
- VaultFactory
- VaultFactoryLibV1
- VaultLibV1
- VaultLiquidity
- VaultStrategy
- WithFlashLoan
- WithPausability
- WithRecovery
- Witness