-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to move liquidity from Compound to CapybaraFinance (#5
) * feat: add ability to move liquidity from Compound to Capybara * feat: update contracts version 1.0.0 => 1.1.0 * docs: improve comments
- Loading branch information
1 parent
f74820c
commit b31ae14
Showing
5 changed files
with
433 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
/** | ||
* @title CapybaraLiquidityPoolMock contract | ||
* @author CloudWalk Inc. (See https://cloudwalk.io) | ||
* @dev A simplified version of the liquidity pool smart-contract of the `CapybaraFinance` protocol | ||
* to use in tests for other contracts. | ||
*/ | ||
contract CapybaraLiquidityPoolMock { | ||
/// @dev The address of the underlying token. | ||
address public underlyingToken; | ||
|
||
// ------------------ Events ---------------------------------- // | ||
|
||
/// @dev Emitted when the `deposit()` function is called with the parameters of the function. | ||
event MockDepositCalled( | ||
uint256 amount | ||
); | ||
|
||
// ------------------ Constructor ----------------------------- // | ||
|
||
/** | ||
* @dev The constructor of the contract. | ||
* @param underlyingToken_ The address of the underlying token. | ||
*/ | ||
constructor(address underlyingToken_) { | ||
underlyingToken = underlyingToken_; | ||
} | ||
|
||
// ------------------ Functions ------------------------------ // | ||
|
||
/** | ||
* @dev Imitates the same-name function of the liquidity pool of the `CapybaraFinance` protocol. | ||
* @param amount The amount of the underlying token to deposit. | ||
*/ | ||
function deposit(uint256 amount) external { | ||
emit MockDepositCalled(amount); | ||
IERC20(underlyingToken).transferFrom(msg.sender, address(this), amount); | ||
} | ||
|
||
/** | ||
* @dev Imitates the same-name function of the liquidity pool of the `CapybaraFinance` protocol. | ||
* @return The address of the underlying token. | ||
*/ | ||
function token() external view returns (address) { | ||
return underlyingToken; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.