-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from pooltogether/pool-2332-fix-dust-problem-i…
…n-aave-v2-yield-source fix(contract): fix supplyTokenTo and redeemToken amounts
- Loading branch information
Showing
8 changed files
with
376 additions
and
248 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.6; | ||
|
||
import "./ERC20Mintable.sol"; | ||
|
||
contract ATokenMintable is ERC20Mintable { | ||
address public immutable underlyingAssetAddress; | ||
|
||
constructor( | ||
address _underlyingAssetAddress, | ||
string memory _name, | ||
string memory _symbol, | ||
uint8 decimals_ | ||
) ERC20Mintable(_name, _symbol, decimals_) { | ||
underlyingAssetAddress = _underlyingAssetAddress; | ||
} | ||
|
||
/* solhint-disable func-name-mixedcase */ | ||
function UNDERLYING_ASSET_ADDRESS() external view returns (address) { | ||
return underlyingAssetAddress; | ||
} | ||
} |
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,41 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.6; | ||
|
||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
import { ATokenMintable } from "./ATokenMintable.sol"; | ||
|
||
contract AaveLendingPool { | ||
IERC20 public immutable token; | ||
ATokenMintable public immutable aToken; | ||
|
||
constructor( | ||
IERC20 _token, | ||
ATokenMintable _aToken | ||
) { | ||
token = _token; | ||
aToken = _aToken; | ||
} | ||
|
||
/* solhint-disable no-unused-vars */ | ||
function deposit( | ||
address asset, | ||
uint256 amount, | ||
address onBehalfOf, | ||
uint16 referralCode | ||
) external { | ||
IERC20(asset).transferFrom(msg.sender, address(this), amount); | ||
aToken.mint(onBehalfOf, amount); | ||
} | ||
|
||
function withdraw( | ||
address asset, | ||
uint256 amount, | ||
address to | ||
) external returns (uint256) { | ||
aToken.burn(msg.sender, amount); | ||
IERC20(asset).transfer(to, amount); | ||
return amount; | ||
} | ||
} |
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
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.