Geo-Web-Project / cadastre

Map-based interface for claiming, buying, and managing Geo Web land parcels.
https://geoweb.land/
MIT License
26 stars 15 forks source link

Feat/safe minimum eth wrap #413

Closed 0xRowdy closed 1 year ago

0xRowdy commented 1 year ago

Description

Compare Required ETHx and Wallet Balance minus buffer for gas of 0.002 and wrap the lesser. (Required ETHx >= Compare wallet balance - gas buffer)

Issue

402

Until ETHx is able to be used to pay gas fees via Gelato's SyncFee, wrap ETH to ETHx incrementally with each batch transaction. Wrap the lesser of: Required ETHx transfer (claim payment/bid collateral/+ buffer deposit) + For Sale Price*.1 (1 year worth of streamed network fees) ETH Balance - .002 (i.e. leave .002 ETH for gas) If this value is equal to or less than the Required ETHx Transfer, then the "Insufficient Funds" error message should be shown and the claim button should be greyed out (i.e. they at least need to be able to pay upfront costs)

fixes #ISSUE

Checklist:

Additional comments

I'm not confident that claim payment/bid collateral/+buffer deposit) + For Sale Price * 0.1 are all in the formula. It appeared that there was already logic in the code to determine the Required ETHx so I attempted to leverage that.

Is this the appropriate place for this logic?

Alert Reviewers

@codynhat @gravenp

tnrdd commented 1 year ago

I think the logic is correct, requiredPayment is what is needed to be paid upfront plus a small buffer and requiredFlowAmount is one year of network fees, approximately 10℅ of the for sale price.

Passing the wrapAmount prop to PerformButton is alright, maybe it could be calulated there if it is the only place where is used.

gravenp commented 1 year ago

@0xRowdy could you take look at the compile error that's failing the build?