Skip to content

Conversation

@AurelienDEMEUSY
Copy link
Collaborator

Description

Please provide a detailed description of what was done in this PR.
switch from local storage to

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it.

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have tested this code
  • I have added sufficient documentation in the code

Additional comments

Please post additional comments in this section if you have them, otherwise delete it.

…ion; [ADD] Add .env.example and new docker-compose.dev.yml for development; [UPDATE] Update backend Dockerfile and package.json for new dependencies; [ADD] Implement Turbos DEX and Flash Loan adapters; [ADD] User data service and API routes for user data management; [UPDATE] Enhance simulator and transaction builder for network flexibility
…c parameters; [ADD] Implement Turbos-specific fields for testnet in BlockCard; [UPDATE] Modify strategy building logic to accommodate network variations.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates user data storage from localStorage to on-chain smart contract storage and adds comprehensive network support (mainnet/testnet/devnet). It introduces a new user data management system with blockchain-based persistence, automatic protocol routing for different networks, enhanced error handling, and API documentation via Swagger.

Changes:

  • Migration from localStorage to on-chain storage using UserDataStorage smart contract
  • Network-aware protocol routing (e.g., NAVI → TURBOS on testnet where NAVI is unavailable)
  • New API endpoints for user data management with Swagger documentation
  • Enhanced error handling with clear distinction between configuration and funding errors
  • Support for new protocols (TURBOS, perpetual trading)

Reviewed changes

Copilot reviewed 34 out of 37 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
frontend/src/hooks/useUserData.ts New hook for managing on-chain user data (strategies, execution history)
frontend/src/app/app/sections/BuilderSection/utils/strategyBuilder.ts Network-aware strategy building with TURBOS support on testnet
frontend/src/app/app/sections/BuilderSection/index.tsx Network context integration
frontend/src/app/app/sections/BuilderSection/components/Canvas.tsx Network prop threading
frontend/src/app/app/sections/BuilderSection/components/BlockCard.tsx Turbos-specific UI fields for testnet
frontend/pnpm-lock.yaml Dependency updates
frontend/docker-compose*.yml New Docker configuration files
docker-compose.yml Root Docker compose removed (migrated to subdirectories)
backend/src/types/strategy.ts Extended types for TURBOS and perpetual trading
backend/src/services/UserDataService.ts Smart contract interaction service for user data
backend/src/services/SuiClientService.ts Singleton SuiClient service
backend/src/core/transaction-builder.ts Network-aware protocol routing
backend/src/core/simulator.ts Enhanced error messages with configuration vs funding distinction
backend/src/config/swagger.ts Swagger documentation configuration
backend/src/config/admin.ts Admin configuration exports
backend/src/config/addresses.ts Network-based address configuration
backend/src/api/server.ts Swagger UI integration and new userdata routes
backend/src/api/routes/userdata.ts API endpoints for user data management
backend/src/api/routes/swagger-annotations.ts Swagger API documentation
backend/src/api/routes/simulation.ts Network parameter support
backend/src/api/routes/build.ts Network-aware transaction building
backend/src/adapters/perp/* New perpetual trading adapter structure
backend/src/adapters/flashloan/navi-adapter.ts Network-aware configuration
backend/src/adapters/dex/cetus-adapter.ts Network-aware initialization
backend/package.json Swagger dependencies added
backend/move/Move.lock Move compiler version and package ID updates
backend/docker-compose*.yml New Docker configuration files
backend/Dockerfile Port correction
Files not reviewed (1)
  • backend/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const params = node.params as TurbosSwapParams;

// Get Turbos config (will throw if not on testnet)
const turbosConfig = this.getTurbosConfig();
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable turbosConfig.

Suggested change
const turbosConfig = this.getTurbosConfig();
this.getTurbosConfig();

Copilot uses AI. Check for mistakes.

// Determine which coin type is the input
const inputCoinType = user_a2b ? params.coin_type_a : params.coin_type_b;
const outputCoinType = user_a2b ? params.coin_type_b : params.coin_type_a;
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable outputCoinType.

Suggested change
const outputCoinType = user_a2b ? params.coin_type_b : params.coin_type_a;

Copilot uses AI. Check for mistakes.

async preOpenPosition(node: PerpOpenNode): Promise<PerpEstimate> {
const params = node.params;
const config = this.getConfig();
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable config.

Copilot uses AI. Check for mistakes.
}

openPosition(tx: Transaction, node: PerpOpenNode, collateral: any, estimate: PerpEstimate): any {
const params = node.params;
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable params.

Copilot uses AI. Check for mistakes.

openPosition(tx: Transaction, node: PerpOpenNode, collateral: any, estimate: PerpEstimate): any {
const params = node.params;
const config = this.getConfig();
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable config.

Copilot uses AI. Check for mistakes.
}

closePosition(tx: Transaction, node: PerpCloseNode, position: any, estimate: PerpEstimate): any {
const params = node.params;
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable params.

Suggested change
const params = node.params;

Copilot uses AI. Check for mistakes.

closePosition(tx: Transaction, node: PerpCloseNode, position: any, estimate: PerpEstimate): any {
const params = node.params;
const config = this.getConfig();
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable config.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,362 @@
import { SuiClient } from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';
import { getAdminSigner, PACKAGE_ID } from '../config/admin';
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import getAdminSigner.

Suggested change
import { getAdminSigner, PACKAGE_ID } from '../config/admin';
import { PACKAGE_ID } from '../config/admin';

Copilot uses AI. Check for mistakes.
Comment on lines +192 to +197
let needsParamAdaptation = false;

// Auto-redirect: Navi → Turbos on testnet
if (this.network === "testnet" && protocol === "NAVI") {
targetProtocol = "TURBOS";
needsParamAdaptation = true;
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value assigned to needsParamAdaptation here is unused.

Suggested change
let needsParamAdaptation = false;
// Auto-redirect: Navi → Turbos on testnet
if (this.network === "testnet" && protocol === "NAVI") {
targetProtocol = "TURBOS";
needsParamAdaptation = true;
// Auto-redirect: Navi → Turbos on testnet
if (this.network === "testnet" && protocol === "NAVI") {
targetProtocol = "TURBOS";

Copilot uses AI. Check for mistakes.
@Intermarch3
Copy link
Contributor

Avant de merge la pr :

  • Doit tester plus en détails le stockage on-chain
  • Réfléchir si stockage des donnée directement on-chain est une bonne solution ou il existe qqc de plus adapté (walrus).
  • Enlever les nouveaux adapter et les mettres dans une autres pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants