### EIP-712 Signed Order Configuration Example Source: https://docs.krystal.app/technical/security Example of a signed order configuration payload used in Krystal's V3 Automation. Users sign this structured data off-chain using EIP-712, and it is stored by Krystal. The payload includes chain ID, NFT position manager address, token ID, order type, and detailed configuration for rebalancing actions and conditions. ```json { "chainId": 42161, "nfpmAddress": "0xc36442b4a4522e871399cd717abdd847ab11fe88", "tokenId": "2008812", "orderType": "ORDER_TYPE_REBALANCE", "config": { "rangeOrderConfig": { "action": { "maxGasProportion": "0", "swapSlippage": "0", "withdrawSlippage": "0" }, "condition": { "gteTickAbsolute": 0, "lteTickAbsolute": 0, "zeroToOne": false } }, "rebalanceConfig": { "autoCompound": { "action": { "feeToPrincipalRatioThreshold": "922337203685477632", "maxGasProportion": "970925927575628544" } }, "rebalanceAction": { "liquiditySlippage": "184467440737095520", "maxGasProportion": "970925927575628544", "priceOffsetAction": { "baseToken": 0, "priceLowerOffset": "0", "priceUpperOffset": "0" }, "swapSlippage": "184467440737095520", "tickOffsetAction": { "tickLowerOffset": 102, "tickUpperOffset": 100 }, "tokenRatioAction": { "tickWidth": 0, "token0Ratio": "0" }, "type": "ACTION_TYPE_PERCENTAGE" }, "rebalanceCondition": { "priceOffsetCondition": { "baseToken": 0, "gtePriceOffset": "0", "ltePriceOffset": "0" }, "sqrtPriceX96": "79214759379423715127847", "tickOffsetCondition": { "gteTickOffset": 4, "lteTickOffset": 7 }, "timeBuffer": 3600, "tokenRatioCondition": { "gteToken0Ratio": "0", "lteToken0Ratio": "0" }, "type": "CONDITION_TYPE_PERCENTAGE" }, "recurring": true } }, "signatureTime": 1713927796 } ``` -------------------------------- ### Solidity execute Function with Signature Verification Source: https://docs.krystal.app/technical/security Solidity function that executes a user's order after verifying the signature matches the position owner. It recovers the user address from the order configuration and signature, requires it to match the provided user address, and then proceeds with execution. Only callable by the OPERATOR_ROLE and when the contract is not paused. ```solidity function execute(ExecuteParams calldata params) public payable onlyRole(OPERATOR_ROLE) whenNotPaused() { address userAddress = _recover(params.userConfig, params.orderSignature); require(userAddress == params.userAddress); _execute(params); } ```