-
-
Save Jonah246/fad9e489fe84a6fb8b4894d7377fd8a2 to your computer and use it in GitHub Desktop.
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
pragma solidity 0.6.10; | |
pragma experimental "ABIEncoderV2"; | |
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol"; | |
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; | |
import { IERC777Sender } from "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol"; | |
import { IERC1820Registry } from "@openzeppelin/contracts/introspection/IERC1820Registry.sol"; | |
import { ISetToken } from "../interfaces/ISetToken.sol"; | |
import { MockManagerWallet } from "./MockManagerWallet.sol"; | |
interface CompoundLeverageModuleLike { | |
function sync(ISetToken _setToken, bool _shouldAccrueInterest) external; | |
} | |
interface IssuanceModuleLike { | |
function issue( | |
ISetToken _setToken, | |
uint256 _quantity, | |
address _to | |
) external; | |
function redeem( | |
ISetToken _setToken, | |
uint256 _quantity, | |
address _to | |
) external; | |
} | |
contract TestContract is IERC777Recipient { | |
ISetToken setToken; | |
CompoundLeverageModuleLike compoundModule; | |
IssuanceModuleLike issueModule; | |
IERC1820Registry constant internal _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); | |
IERC20 CETH = IERC20(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5); | |
MockManagerWallet manager; | |
IERC20 cToken; | |
IERC20 wfCash; | |
bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender"); | |
bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient"); | |
constructor( | |
ISetToken _setToken, | |
CompoundLeverageModuleLike _compoundModule, | |
IssuanceModuleLike _issueModule, | |
IERC20 _cToken, | |
IERC20 _wfCash, | |
MockManagerWallet _manager | |
) public { | |
setToken = _setToken; | |
compoundModule = _compoundModule; | |
issueModule = _issueModule; | |
cToken = _cToken; | |
wfCash = _wfCash; | |
manager = _manager; | |
} | |
function test(uint256 _amount) external { | |
cToken.approve(address(issueModule), uint256(-1)); | |
wfCash.approve(address(issueModule), uint256(-1)); | |
issueModule.issue(setToken, _amount, address(this)); | |
issueModule.redeem(setToken, _amount, address(this)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment