aboutsummaryrefslogtreecommitdiff
path: root/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
blob: 0becab7b9d6f1f4f95e80bcff84b297e81920a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package tech.libeufin.sandbox

import io.ktor.application.*
import io.ktor.response.*
import io.ktor.routing.*

// CIRCUIT API TYPES

// Configuration response:
class ConfigResp(
    val name: String = "circuit",
    val version: String = SANDBOX_VERSION,
    val ratios_and_fees: RatioAndFees
)

// After fixing #7527, the values held by this
// type must be read from the configuration.
class RatioAndFees(
    val buy_at_ratio: Float = 1F,
    val sell_at_ratio: Float = 0.05F,
    val buy_in_fee: Float = 0F,
    val sell_out_fee: Float = 0F
)

fun circuitApi(circuitRoute: Route) {
    circuitRoute.get("/config") {
        call.respond(ConfigResp(
            ratios_and_fees = RatioAndFees()
        ))
        return@get
    }
}