Open jalextowle opened 8 months ago
This ideally would also need to account for auto-closing positions & zombie interest
Yeah, that was the idea behind this issue. Checkpointing accounts for matured positions (you could call this auto-closing), zombie interest, and it distributes excess idle to the withdrawal pool. Here is the checkpoint function in Solidity for context: https://github.com/delvtech/hyperdrive/blob/main/contracts/src/internal/HyperdriveCheckpoint.sol
One of the current limitations of the Rust SDK is that it doesn't simulate checkpoints. This means that when the Rust SDK is used to run a simulation at a checkpoint boundary before a new trade has been made, the result could be very inaccurate. The best version of the Rust SDK would simulate the application of checkpoints by replicating the checkpointing logic and the distribute excess idle calculation.