hop-protocol / contracts

🐰 Hop Protocol v1 smart contracts
https://hop.exchange
239 stars 83 forks source link

contracts: autogenerate nonce #19

Closed cwhinfrey closed 3 years ago

cwhinfrey commented 3 years ago

Why? This allows us to assign a unique nonce and therefor unique transferId to every transfer without any risk of collision across multiple independent chains. We could alternatively use the origin chainId in the getTransferId calculation but then we'd have to pass it in to all of the withdraw functions.

cwhinfrey commented 3 years ago

I can't think of a specific reason we would need it. Would be fine with making it private.

shanefontaine commented 3 years ago

No, I was more thinking of someone needing an old trnasferNonceIncrementer while trying to reconstruct a specific transferId.

I think it is good as-is. Please merge this if you agree.