Created
September 7, 2021 03:41
-
-
Save hihiben/d2050396cefccfda94a34420979ceaa7 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=true&runs=200&gist=
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
/// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.8.7; | |
interface IERC20 { | |
function balanceOf(address account) external view returns(uint256); | |
} | |
interface IProxy { | |
function batchExec(address[] calldata tos, bytes32[] calldata configs, bytes[] memory datas) external payable; | |
} | |
contract test { | |
IProxy public proxy; | |
address constant public HWETH = 0x9e2Ba701cf5Dc47096060BB0a773e732BEE68dE6; | |
constructor(IProxy _proxy) { | |
proxy = _proxy; | |
} | |
function getTos() public pure returns (address[] memory tos) { | |
tos = new address[](1); | |
tos[0] = HWETH; | |
} | |
function getConfigs() public pure returns (bytes32[] memory configs) { | |
configs = new bytes32[](1); | |
configs[0] = bytes32(0); | |
} | |
function getDatas() public pure returns (bytes[] memory datas) { | |
datas = new bytes[](1); | |
datas[0] = abi.encodeWithSignature("deposit(uint256)", 0.1 ether); | |
} | |
function go() public payable { | |
proxy.batchExec{ value: msg.value }(getTos(), getConfigs(), getDatas()); | |
} | |
function lowgo(bytes memory payload) public payable { | |
(bool ok, bytes memory result) = address(proxy).call{ value: msg.value }(payload); | |
require(ok, string(result)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment