2025-01-24 15:28:29 +01:00
|
|
|
function pricePerSlotPerSecond(request) {
|
|
|
|
return request.ask.pricePerBytePerSecond * request.ask.slotSize
|
|
|
|
}
|
|
|
|
|
2024-10-08 09:38:19 +02:00
|
|
|
function maxPrice(request) {
|
2025-01-24 15:28:29 +01:00
|
|
|
return (
|
|
|
|
request.ask.slots * request.ask.duration * pricePerSlotPerSecond(request)
|
|
|
|
)
|
2022-07-20 11:07:20 +02:00
|
|
|
}
|
|
|
|
|
2024-10-08 09:38:19 +02:00
|
|
|
function payoutForDuration(request, start, end) {
|
2025-01-24 15:28:29 +01:00
|
|
|
return (end - start) * pricePerSlotPerSecond(request)
|
2022-07-20 11:07:20 +02:00
|
|
|
}
|
|
|
|
|
2025-01-24 15:28:29 +01:00
|
|
|
module.exports = { maxPrice, pricePerSlotPerSecond, payoutForDuration }
|