delvtech / hyperdrive-rs

Rust SDK for the Hyperdrive AMM.
https://docs.rs/crate/hyperdrive-math/latest
Apache License 2.0
2 stars 0 forks source link

Standardize the function names within the Rust SDK #47

Open jalextowle opened 8 months ago

jalextowle commented 8 months ago

I'm not a huge fan of names like calculate_close_long_flat_plus_curve, and I think we can come up with something better for these names. Even if we don't, we should ensure that all of the names used throughout the Rust SDK are internally consistent.

dpaiton commented 7 months ago

in the python interface we use

get_* --> "using an RPC or web (wget; curl) request" (something akin to "over the internet" but obv not exactly that for strictly local instances)

and

calc_* --> stand-alone function for calculating a value (typically numerics in & numerics out; typically calls an underlying rust fn

However I don't think the rust code has any RPC calls (except for maybe in tests and maybe the agent actions?), or rather the stuff we export to python does not. So honestly I'd rather us drop the prefix all together. Something like bonds_out = close_long_flat_plus_curve(base_in). If they're all "calculating" then why bother?

jalextowle commented 7 months ago

I like the idea of dropping the calculate prefix, but we will need to disambiguate between the state transition functions and the functions that preview the return value. With that in mind, I think it’s premature to drop all of the prefixes, but I could be convinced otherwise.