Added error when StartTime is less than block time
Added error handling for AMM functions
k = x1^(1-t) + y1^(1-t)
If x2 is too large x2^(1-t) > k, so y2^(1-t) become < 0.
Then y2 = y2^(1-t)^(1/(1-t)) cannot be calculated.
Therefore, return value should be 0 or y1(all amount in pool).
Current returns 0 (= error), but you may verify that you can give y1 and set y in the pool to 0.
Change AMM code & Impl test
k = x1^(1-t) + y1^(1-t)
If x2 is too largex2^(1-t) > k
, soy2^(1-t)
become < 0. Theny2 = y2^(1-t)^(1/(1-t))
cannot be calculated.Therefore, return value should be 0 or y1(all amount in pool). Current returns 0 (= error), but you may verify that you can give y1 and set y in the pool to 0.
I think error return is a safe now.