-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStrategy.sol
More file actions
73 lines (62 loc) · 2 KB
/
Strategy.sol
File metadata and controls
73 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {console} from "forge-std/Test.sol";
import {IERC20} from "../../interfaces/IERC20.sol";
import {Math} from "../../lib/Math.sol";
import {Auth} from "../../lib/app/Auth.sol";
import "../../Constants.sol";
import {GmxHelper} from "./GmxHelper.sol";
contract Strategy is Auth, GmxHelper {
IERC20 public constant weth = IERC20(WETH);
constructor(address oracle)
GmxHelper(
GM_TOKEN_ETH_WETH_USDC,
WETH,
USDC,
CHAINLINK_ETH_USD,
CHAINLINK_USDC_USD,
oracle
)
{}
receive() external payable {}
// Task 1: Calculate total vaule managed by this contract in terms of WETH
function totalValueInToken() external view returns (uint256) {}
// Task 2: Create market increase order
function increase(uint256 wethAmount)
external
payable
auth
returns (bytes32 orderKey)
{}
// Task 3: Create market decrease order
// Function call is from the vault when the callback contract is not address(0).
function decrease(uint256 wethAmount, address callbackContract)
external
payable
auth
returns (bytes32 orderKey)
{
if (callbackContract == address(0)) {
// Write your code here
} else {
// Write your code here
}
}
// Task 4: Cancel an order
function cancel(bytes32 orderKey) external payable auth {}
// Task 5: Claim funding fees
function claim() external {}
function transfer(address dst, uint256 amount) external auth {
weth.transfer(dst, amount);
}
function withdraw(address token) external auth {
if (token == address(0)) {
(bool ok,) = msg.sender.call{value: address(this).balance}("");
require(ok, "Send ETH failed");
} else {
IERC20(token).transfer(
msg.sender, IERC20(token).balanceOf(address(this))
);
}
}
}