Quickstart
Get the SDK
The Solidity base contract and interfaces are served from /sdk/. Copy them into your Foundry project:
curl -O https://elysio.fun/sdk/IElysio.sol curl -O https://elysio.fun/sdk/ElysioClient.sol curl -O https://elysio.fun/sdk/MockElysioRouter.sol
Write a consumer
Inherit ElysioClient, send intents with _request, and handle every outcome in _onReceipt. Only the router can call it.
contract MyVault is ElysioClient {
int256 public position;
constructor(IElysioRouter router) ElysioClient(router, msg.sender) {}
function buy(uint64 sz, uint64 limitPx) external onlyElysioOwner returns (uint256) {
return _request(ElysioTypes.Intent({
asset: 10107, // HYPE/USDC spot on HyperCore
isBuy: true,
reduceOnly: false,
tif: ElysioTypes.Tif.Ioc,
sz: sz, // 8 decimals: 0.18 HYPE = 18_000_000
limitPx: limitPx, // 8 decimals
deadline: uint64(block.timestamp + 60),
callbackGas: 150_000
}));
}
function _onReceipt(uint256, ElysioTypes.Receipt calldata r) internal override {
if (r.status == ElysioTypes.Status.Filled || r.status == ElysioTypes.Status.Partial) {
position += int256(uint256(r.filledSz));
}
}
}Test it with the mock router
MockElysioRouter records intents and answers them with scripted receipts, through the same onReceipt call the real router makes.
MockElysioRouter m = new MockElysioRouter(); MyVault v = new MyVault(IElysioRouter(address(m))); uint256 id = v.buy(0.18e8, 61e8); m.answer(id, ElysioTypes.Status.Partial, 0.07e8, 60.95e8); assertEq(v.position(), 0.07e8);
Then the sandbox
The sandbox on the home page simulates a fork of Elysium with the router, two bonded relayers and a QuickVault you own. Intents there are priced on the live HyperCore book and answered by a simulated relayer; nothing is traded.
Then a real intent
Bind your contract to a HyperCore account (Bind), fund a callback subscription in HYPE, and send. The first real intents should be small: HyperCore's minimum order value is 10 USDC.