Complex formula in server action

I have a server action that gets data from an API call and some values are then stored in my database

So I first have the api call and then a database insert action

In this db record I need to store a value that needs a (complex) formula to calculate it’s value based on different values from the api call

So in the value field I have build this formula but now I wonder is this is the right way/place to do this calculation…

This is the formula:
{{($_POST.gasfee+(api.data.last_sale.total_price/1000000000000000000))+((($_POST.gasfee+(api.data.last_sale.total_price))/100))*((api.data.collection.primary_asset_contracts[0].dev_seller_fee_basis_points/100)+(api.data.collection.primary_asset_contracts[0].opensea_seller_fee_basis_points/100))}}

This is how it looks:

Is this the way to go?

Community Page
Last updated: