Skip to content

Flooring seconds in compoundInterest #124

@holyfuchs

Description

@holyfuchs

compoundInterest is calculating the interest rate based on floored seconds:

https://github.com/onflow/FlowCreditMarket/blob/786cfa93251ee0ebb1788e9ebebf7b35c2b22b6c/cadence/lib/FlowCreditMarketMath.cdc#L21-L39

https://github.com/onflow/FlowCreditMarket/blob/786cfa93251ee0ebb1788e9ebebf7b35c2b22b6c/cadence/contracts/FlowCreditMarket.cdc#L4557-L4565

timestamp: UFix64
If getCurrentBlock().timestamp has a resolution below 1 second (utilizing the UFix), interacting with the contract every block will result in no interest accruing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions