move all defi functionality to page and separate controller

This commit is contained in:
Timur Gordon
2025-05-01 02:55:41 +02:00
parent 457f3c8268
commit 6b7b2542ab
21 changed files with 2198 additions and 1505 deletions

View File

@@ -9,6 +9,7 @@ use crate::controllers::flow::FlowController;
use crate::controllers::contract::ContractController;
use crate::controllers::asset::AssetController;
use crate::controllers::marketplace::MarketplaceController;
use crate::controllers::defi::DefiController;
use crate::middleware::JwtAuth;
use crate::SESSION_KEY;
@@ -120,6 +121,18 @@ pub fn configure_routes(cfg: &mut web::ServiceConfig) {
.route("/{id}/purchase", web::post().to(MarketplaceController::purchase_listing))
.route("/{id}/cancel", web::post().to(MarketplaceController::cancel_listing))
)
// DeFi routes
.service(
web::scope("/defi")
.route("", web::get().to(DefiController::index))
.route("/lending", web::post().to(DefiController::create_lending))
.route("/borrowing", web::post().to(DefiController::create_borrowing))
.route("/liquidity", web::post().to(DefiController::add_liquidity))
.route("/staking", web::post().to(DefiController::create_staking))
.route("/swap", web::post().to(DefiController::swap_tokens))
.route("/collateral", web::post().to(DefiController::create_collateral))
)
);
// Keep the /protected scope for any future routes that should be under that path