-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestExchange.sol
51 lines (44 loc) · 1.8 KB
/
TestExchange.sol
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
// SPDX-License-Identifier: MIT
pragma solidity >0.6.6;
import {IExchangeModule} from "./Exchange.sol";
contract TestExchange {
address constant exchangeContract = 0x0000000000000000000000000000000000000065;
IExchangeModule exchange = IExchangeModule(exchangeContract);
function deposit(
string memory subaccountID,
string memory denom,
uint256 amount
) external returns (bool) {
return exchange.deposit(address(this), subaccountID, denom, amount);
}
function delegateDeposit(
string memory subaccountID,
string memory denom,
uint256 amount
) external returns (bool) {
(bool success,) = exchangeContract.delegatecall(abi.encodeWithSignature("deposit(string,string,string,uint256)", address(this), subaccountID, denom, amount));
return success;
}
function withdraw(
string memory subaccountID,
string memory denom,
uint256 amount
) external returns (bool) {
return exchange.withdraw(address(this), subaccountID, denom, amount);
}
function createDerivativeLimitOrder(
IExchangeModule.DerivativeOrder calldata order
) external returns (IExchangeModule.CreateDerivativeLimitOrderResponse memory response) {
return exchange.createDerivativeLimitOrder(address(this), order);
}
function createDerivativeLimitOrderAuthz(
address sender,
IExchangeModule.DerivativeOrder calldata order
) external returns (IExchangeModule.CreateDerivativeLimitOrderResponse memory response) {
try exchange.createDerivativeLimitOrderAuthz(sender, order) returns (IExchangeModule.CreateDerivativeLimitOrderResponse memory resp) {
return resp;
} catch {
revert("error creating derivative limit order");
}
}
}