Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial rollupinvoker working concept #16

Closed
wants to merge 74 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
90f03ed
initial extensions commit
test9955667 Jun 1, 2023
f2bcdb9
restructure order types and invoker
test9955667 Jun 5, 2023
4c417f4
collateral as delta + cleanup
test9955667 Jun 5, 2023
35ba265
collateral as delta
test9955667 Jun 5, 2023
ec9a44f
unused param
test9955667 Jun 5, 2023
8920393
pct max fee -> fixed6
test9955667 Jun 5, 2023
98fd026
imrpoved structure and invoker actions
test9955667 Jun 7, 2023
cff9243
rollup contracts wip
test9955667 Jun 7, 2023
5b7de4a
update gitignore
test9955667 Jun 7, 2023
29d2889
update dependencies
test9955667 Jun 7, 2023
5df2291
add extensions tests
test9955667 Jun 7, 2023
a975e11
Merge branch 'main' into order-types
test9955667 Jun 7, 2023
670d66e
update root imports
test9955667 Jun 7, 2023
9659b92
update root deps
test9955667 Jun 7, 2023
2ed0aa6
update test for v2 struct change
test9955667 Jun 7, 2023
cee7151
Merge branch 'main' into order-types
test9955667 Jun 7, 2023
b14b31f
remove types :3
test9955667 Jun 7, 2023
c63d57f
merge conflicts and deps
test9955667 Jun 7, 2023
8bc8b25
yarn lock conflicts
test9955667 Jun 7, 2023
ccd09f6
remove max pct from test
test9955667 Jun 7, 2023
054c8a7
cfg
test9955667 Jun 9, 2023
a5fc12a
comments
test9955667 Jun 9, 2023
191c1a0
unit keepermanager tests
test9955667 Jun 9, 2023
df5bb32
test init
test9955667 Jun 9, 2023
2ead957
Merge branch 'main' into order-types
test9955667 Jun 9, 2023
3900979
fix number conversions and token transfer logic
test9955667 Jun 12, 2023
04cc9a6
add test coverage
test9955667 Jun 12, 2023
72924b5
merge keeper manager + multiinvoker
test9955667 Jun 12, 2023
08540a4
chore: forge init
test9955667 Jun 14, 2023
c1dd0a9
b4 move forge changes to new branch
test9955667 Jun 19, 2023
ba40161
skip self exec fee check
test9955667 Jun 19, 2023
44a82ce
reconcile kbrizzle
test9955667 Jun 19, 2023
ec8a6ce
resolve yanr conflict
test9955667 Jun 19, 2023
cfa082a
update main
test9955667 Jun 19, 2023
fecf960
add OZ math sqrt
test9955667 Jun 21, 2023
15b9f0a
add integration helpers
test9955667 Jun 21, 2023
a8e9883
add set pending position
test9955667 Jun 21, 2023
40c17c7
update unit tests
test9955667 Jun 21, 2023
cf1cf0d
cleanup
test9955667 Jun 21, 2023
1d05ab7
mainnet addresses
test9955667 Jun 21, 2023
9378f2c
int tests
test9955667 Jun 21, 2023
780897e
improve fee calc and add market dsu approval
test9955667 Jul 6, 2023
38c8e17
add agg to get fee base eth price
test9955667 Jul 6, 2023
0b950cd
update interface
test9955667 Jul 6, 2023
15ea942
comments and msg.sender preservation
test9955667 Jul 6, 2023
64330c1
remove foundry stuff from branch
test9955667 Jul 6, 2023
7892331
fix doc tag
test9955667 Jul 6, 2023
9e835d6
add optional out of package use
test9955667 Jul 6, 2023
739379e
update package settings
test9955667 Jul 6, 2023
a6cb7fb
more test coverage
test9955667 Jul 6, 2023
495dee7
move rollup invoker to new branch
test9955667 Jul 6, 2023
b894812
add file back
test9955667 Jul 6, 2023
c0dcbd8
absolute pos cleaned up
test9955667 Jul 6, 2023
748a2b3
use chainlink impl
test9955667 Jul 6, 2023
704fa43
remove copy
test9955667 Jul 6, 2023
cfc354a
rm foundry
test9955667 Jul 6, 2023
75fc71a
add feed registry
test9955667 Jul 6, 2023
306aebd
resolve merge conflicts
test9955667 Jul 6, 2023
f738b84
resolve merge conflicts
test9955667 Jul 7, 2023
f989db2
update lockfile
test9955667 Jul 7, 2023
b869abf
test fixes
test9955667 Jul 7, 2023
2abde9a
update from main
test9955667 Jul 7, 2023
5d0b95e
position deltas
test9955667 Jul 7, 2023
d90b6f0
get MIR to compile
test9955667 Jul 8, 2023
c10bff3
fix encoding add tests
test9955667 Jul 10, 2023
0843ce8
cleanup
test9955667 Jul 10, 2023
4120d2f
more test fix + cleanup
test9955667 Jul 10, 2023
feb6a7a
merge conflicts
test9955667 Jul 10, 2023
c30b11d
rm override
test9955667 Jul 11, 2023
25a3aa8
remove oz dep
test9955667 Jul 11, 2023
38a428f
rollup debugging
test9955667 Jul 12, 2023
77589e0
update to main
test9955667 Jul 14, 2023
b532ee0
update logic to main
test9955667 Jul 14, 2023
6fc0497
better encoding, testing, bug fixes
test9955667 Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/perennial-extensions/contracts/KeeperManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,25 @@ contract KeeperManager is IKeeperManager {
return canFill;
}

/// @notice Places order on behalf of `account` from the invoker
/// @param account Account to place order for
/// @notice Places order on behalf of msg.sender from the invoker
/// @param market Market to place order in
/// @param order Order state to place
function _placeOrder(
address account,
address market,
Order memory order
) internal {

uint256 _orderNonce = ++orderNonce;
// ++orderNonce;
allOpenOrders[account][market][orderNonce] = order;
allOpenOrders[msg.sender][market][_orderNonce] = order;

++numOpenOrders[account][market];
++numOpenOrders[msg.sender][market];

uint256 _openOrders = numOpenOrders[account][market];
uint256 _openOrders = numOpenOrders[msg.sender][market];
if(_openOrders > MAX_OPEN_ORDERS) revert KeeperManagerMaxOpenOrdersError();

emit OrderPlaced(
account,
msg.sender,
market,
_orderNonce,
_openOrders,
Expand Down
30 changes: 7 additions & 23 deletions packages/perennial-extensions/contracts/MultiInvoker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,17 @@ import { IBatcher } from "@equilibria/emptyset-batcher/interfaces/IBatcher.sol";
import { IEmptySetReserve } from "@equilibria/emptyset-batcher/interfaces/IEmptySetReserve.sol";
import { IInstance } from "@equilibria/root-v2/contracts/IInstance.sol";

// import "hardhat/console.sol";

import {
IMultiInvoker,
IMarket,
Position,
Local,
UFixed18Lib,
UFixed18,
UFixed6,
UFixed6Lib,
Fixed6,
Fixed6Lib,
Token6,
Token18
} from "./interfaces/IMultiInvoker.sol";
import {IKeeperManager} from "./interfaces/IKeeperManager.sol";

import {KeeperManager} from "./KeeperManager.sol";
import "hardhat/console.sol";

import "./interfaces/IMultiInvoker.sol";

import "./KeeperManager.sol";
import "@equilibria/root-v2/contracts/UKept.sol";

contract MultiInvoker is IMultiInvoker, KeeperManager, UKept {

/// @dev Gas buffer estimating remaining execution gas to include in fee to cover further instructions
uint256 constant GAS_BUFFER = 100000; // solhint-disable-line var-name-mixedcase
uint256 public constant GAS_BUFFER = 100000; // solhint-disable-line var-name-mixedcase

/// @dev USDC stablecoin address
Token6 public immutable USDC; // solhint-disable-line var-name-mixedcase
Expand Down Expand Up @@ -97,7 +83,7 @@ contract MultiInvoker is IMultiInvoker, KeeperManager, UKept {
(address market, IKeeperManager.Order memory order)
= abi.decode(invocation.args, (address, IKeeperManager.Order));

_placeOrder(msg.sender, market, order);
_placeOrder(market, order);
} else if (invocation.action == PerennialAction.CANCEL_ORDER) {
(address market, uint256 _orderNonce) = abi.decode(invocation.args, (address, uint256));

Expand Down Expand Up @@ -204,8 +190,6 @@ contract MultiInvoker is IMultiInvoker, KeeperManager, UKept {
false);
}



/// @notice Helper fn to max approve DSU for usage in a market deployed by the factory
/// @param market Market to approve
function _approve(address market) internal {
Expand Down
Loading
Loading