near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
108 stars 77 forks source link

Fix bug where locked_amount and get_available_amount() show incorrect results #68

Closed ctindogaru closed 2 years ago

ctindogaru commented 2 years ago

I've experienced this issue while working on a different PR.

locked_amount does not display the correct result. The amount of near locked for storage is higher than what locked_amount displays. Because of this, self.get_available_amount() which is using locked_amount also does not display the correct result.

If you try to call this from the contract: Promise::new(account_id).transfer(self.get_available_amount().0) it will fail and it will tell you that if you transfer that amount the contract will not have the necessary NEAR to cover the storage costs.

ctindogaru commented 2 years ago

@mikedotexe

ctindogaru commented 2 years ago

@ilblackdragon you're right, thanks for the good feedback! Hopefully, I've addressed all your concerns now :)