Conversation
| owner: String, | ||
| stake_public_key: String, | ||
| reward_fee_fraction: RewardFeeFraction, | ||
| initial_balance: Balance, |
There was a problem hiding this comment.
add a 4th parameter for testing, initial balance
| "The owner account ID is invalid" | ||
| ); | ||
| let account_balance = env::account_balance(); | ||
| assert!( |
There was a problem hiding this comment.
Realistically, this is impossible, because the storage required for the contract itself covers this.
There was a problem hiding this comment.
I see. The contract will stop working way before that.
| "The owner account ID is invalid" | ||
| ); | ||
| let account_balance = env::account_balance(); | ||
| assert!( |
There was a problem hiding this comment.
Realistically, this is impossible, because the storage required for the contract itself covers this.
| ); | ||
| let account_balance = env::account_balance(); | ||
| assert!( | ||
| account_balance > STAKE_SHARE_PRICE_GUARANTEE_FUND, |
There was a problem hiding this comment.
Why this is strictly higher?
There was a problem hiding this comment.
because if account_balance == STAKE_SHARE_PRICE_GUARANTEE_FUND then in the next line total_staked_balance becomes zero. total_staked_balance is used in several share calculations as denominator, so total_staked_balance==0 leads to div by zero panics. (i.e. fn num_shares_from_staked_amount_rounded_down/up)
fixes #99