tqtezos / minter

OpenMinter is dApp framework for enabling the creation and collection of non-fungible tokens (NFTs) on Tezos.
MIT License
192 stars 91 forks source link

Consider using nat type for round_time and action_time #190

Closed emishur closed 3 years ago

emishur commented 3 years ago

https://github.com/tqtezos/minter/blob/9bd894ec8c7a5a5a45d166f6b0c6b49c3810ddc7/contracts/ligo/src/english_auction_tez.mligo#L23

EGuenz commented 3 years ago

It is useful to keep "time passed" values as int to compare timestamps with seconds added. For example, the line Tezos.now <= auction.last_bid_time + auction.round_time only works if auction.round_time is int.

I solve for the chance of passing negative values by giving configure_param the following type:

type configure_param =
  [@layout:comb]
  {
    opening_price : tez;
    min_raise : tez;
    round_time : nat;
    asset : (tokens list);
    auction_time : nat;
    start_time : timestamp;
  }

and then casting the nats to int as in

https://github.com/tqtezos/minter/blob/9bd894ec8c7a5a5a45d166f6b0c6b49c3810ddc7/contracts/ligo/src/english_auction_tez.mligo#L124

EGuenz commented 3 years ago

I also have the following line for round_time:

https://github.com/tqtezos/minter/blob/9bd894ec8c7a5a5a45d166f6b0c6b49c3810ddc7/contracts/ligo/src/english_auction_tez.mligo#L117

I realize now I do not have a similar check for auction time. I will include that

EGuenz commented 3 years ago

Closed by https://github.com/tqtezos/minter/commit/4490a239187cd8a8babee7f6d7cac6cf57d89337