You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-40Lines changed: 40 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Contracts to manage account abstractions and features on top of [Synthetix Perps
25
25
26
26
> See ./deploy-addresses/ for deployed contract addresses
27
27
28
-
The Margin Manager codebase consists of the `Factory` and `Account` contracts, and all of the associated dependencies. The purpose of the `Factory` is to create/deploy trading accounts (`Account` contracts) for users that support features ranging from cross-margin, conditional orders, copy trading, etc.. Once a smart margin account has been created, the main point of entry is the `Account.execute` function. `Account.execute` allows users to execute a set of commands describing the actions/trades they want executed by their account.
28
+
The Smart Margin codebase consists of the `Factory` and `Account` contracts, and all of the associated dependencies. The purpose of the `Factory` is to create/deploy trading accounts (`Account` contracts) for users that support features ranging from cross-margin, conditional orders, copy trading, etc.. Once a smart margin account has been created, the main point of entry is the `Account.execute` function. `Account.execute` allows users to execute a set of commands describing the actions/trades they want executed by their account.
29
29
30
30
### User Entry: MarginBase Command Execution
31
31
@@ -36,24 +36,7 @@ Calls to `Account.execute`, the entrypoint to the smart margin account, require
36
36
37
37
`commands[i]` is the command that will use `inputs[i]` as its encoded input parameters.
38
38
39
-
The supported commands can be found below (ordering may _not_ match what is defined in `IAccount.sol`):
40
-
41
-
```
42
-
ACCOUNT_MODIFY_MARGIN
43
-
ACCOUNT_WITHDRAW_ETH
44
-
PERPS_V2_MODIFY_MARGIN
45
-
PERPS_V2_WITHDRAW_ALL_MARGIN
46
-
PERPS_V2_SUBMIT_ATOMIC_ORDER
47
-
PERPS_V2_SUBMIT_DELAYED_ORDER
48
-
PERPS_V2_SUBMIT_OFFCHAIN_DELAYED_ORDER
49
-
PERPS_V2_CLOSE_POSITION
50
-
PERPS_V2_SUBMIT_CLOSE_DELAYED_ORDER
51
-
PERPS_V2_SUBMIT_CLOSE_OFFCHAIN_DELAYED_ORDER
52
-
PERPS_V2_CANCEL_DELAYED_ORDER
53
-
PERPS_V2_CANCEL_OFFCHAIN_DELAYED_ORDER
54
-
GELATO_PLACE_CONDITIONAL_ORDER
55
-
GELATO_CANCEL_CONDITIONAL_ORDER
56
-
```
39
+
The supported commands can be found in the [wiki](https://github.com/Kwenta/smart-margin/wiki/Commands) and [code](https://github.com/Kwenta/smart-margin/blob/main/src/interfaces/IAccount.sol).
57
40
58
41
#### How the input bytes are structured
59
42
@@ -73,7 +56,7 @@ Encoding parameters in a bytes string in this way gives us maximum flexiblity to
73
56
74
57
For a more detailed breakdown of which parameters you should provide for each command take a look at the `Account.dispatch` function.
75
58
76
-
Developer documentation to give a detailed explanation of the inputs for every command can be found in the [wiki](https://github.com/Kwenta/margin-manager/wiki/Commands)
59
+
Developer documentation to give a detailed explanation of the inputs for every command can also be found in the [wiki](https://github.com/Kwenta/margin-manager/wiki/Commands)
77
60
78
61
#### Diagram
79
62
@@ -100,8 +83,10 @@ Smart margin accounts are upgradable. This is achieved by using a proxy pattern,
100
83
Finally, all associated functionality related to upgradability can be disabled by the `Factory` contract owner.
13. Update `./deploy-addresses/optimism.json` with new `Account` address
196
186
14. Ensure mainnet accounts are updated and functional (ensure state is correct)
197
187
188
+
## External Conditional Order Executors
189
+
> As of SM v2.1.0, public actors can execute conditional orders and receive a fee for doing so
190
+
1. Navigate to `src/utils/executors/OrderExecution.sol`
191
+
2.`OrderExecution` is a *simplified* contract which defines: (1) basic batch conditional order execution functionality, (2) a method to update onchain Pyth oracle price feed(s), (3) **combined** price feed update(s) and then conditional order execution functionality
192
+
> `OrderExecution` is meant to serve as a starting point for developers to build their own conditional order executors and IS NOT production ready nor has it been audited
193
+
3. See https://docs.pyth.network/evm/update-price-feeds for more information on updating Pyth oracle price feeds
194
+
4. See `IAccount.executeConditionalOrder` for more information on conditional order execution
195
+
5. Currently there are no scripts in this repository which deploy the `OrderExecution` contract
196
+
6. See https://github.com/JaredBorders/KwentaOrderExecutor for a conditional order executor that includes deployment scripts
0 commit comments