Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web App Contracts methods validation and missing info #106

Open
13 of 21 tasks
flaviocastro opened this issue Apr 19, 2022 · 6 comments
Open
13 of 21 tasks

Web App Contracts methods validation and missing info #106

flaviocastro opened this issue Apr 19, 2022 · 6 comments
Assignees
Labels
help wanted Extra attention is needed web

Comments

@flaviocastro
Copy link
Contributor

flaviocastro commented Apr 19, 2022

Summary

@naps62 Please take a look at the invoked methods bellow to check that all info is as expected by the app design.
We are missing a few config variable in order to have a stable version, check the "Missing Configs" section bellow.

Data Methods Validation

Project Info Card

  • Contributions - sale1.investorCount().toString()
  • Raised - formatUnits(sale1.tokenToPaymentToken(sale1.allocated()).toString())
  • Price - sale1.rate().toString()
  • My contribution - formatUnits(sale1.paymentTokenToToken(uncappedAllocation(address)).toString())

Sale Form - Buy Flow

  • Check Allowance - aUsd.allowance(address, sale1.address)
  • Request Allowance - await (await contracts.aUsd.connect(signer).approve(sale1.address, amount)).wait() // This is optional, if no allowance left, we ask for more.
  • Buy - sale1.connect(signer).buy(sale1.paymentTokenToToken(amount))
  • Converted aUSD to CTND - amount.times(sale1.rate().toString()).decimalPlaces(4).toString() // This is done on the client side so it can be sync.

Vesting Cards

  • My Tokens - citizend.balanceOf(address).toString()
  • Total Claimed - vesting.claimed(address).toString()
  • Next Release - Anything to do with publicSaleVestingMonths(3) vs publicSaleCliffMonths(0). How can we calculate a date?
  • Available to Claim - vesting.claimablePublic(account).toString()
  • Refund - vesting.claimablePrivate(account).toString()

Missing Configs

Missing App Links URL's

  • TERMS_URL - Terms of Service URL.
  • PRIVACY_POLICY_URL Privacy Policy URL.
  • CAP_CALCULATION_INFO_URL - Sale form Cap Info URL
  • CONTRIBUTE_AGAIN_INFO_URL - Sale modal Cap Info URL
  • FRACTAL_KYC_URL - Fractal profile/KYC URL

Chain ID's Configs:

  • Production Chain ID: [686]
  • Staging Chain ID: [595]
  • Development Chain ID: [595, 31337]
@flaviocastro flaviocastro added the help wanted Extra attention is needed label Apr 19, 2022
@zamith
Copy link
Member

zamith commented Apr 19, 2022

Project Info Card

Raised - To be clear, this is the uncapped amount raised. After the rising tide it can/will be lower. Not sure were it is shown, but just so you know.

Sale Form

Request Allowance - How much do we want to request? Do we assume we will need to request every time they buy. Meaning, we are optimizing for the use case of someone buying once? Have you thought of this?
Converted aUSD to CTND - Any reason for only 4 decimal cases? Is this enough?

Vesting

Next Release - It's always on the first of the month. You can check the number of vesting months and cliff months for the public sale with vesting.publicSaleVestingMonths and vesting.publicSaleCliffMonths and add to the start of the month in which the vesting started. We didn't expose these calculations. For the private sale they are constant, but you can check them at vesting.PRIVATE_SALE_VESTING_MONTHS and the cliff months are defined per account, but are at most 6 months. I don't think we planned to show this, really. @naps62 ?
Available to Claim - This is the function you mentioned for the public sale, but there's also the private sale. If you want both you should use vesting.claimable
Refund - The refund is specific for each sale, but for sale1 you can do sale1.refundAmount(address) to see how much it will be. Then you can call vesting.refund to actually trigger the refund.

@flaviocastro
Copy link
Contributor Author

Sale Form

Request Allowance - As discussed with @naps62, we are asking for the amount the user wants to buy, everytime. Power users can change the allowance requested. Allowing an "infinite" amount sounds too loose. What would be the best approach in your opinion @zamith?
Converted aUSD to CTND - We can have many as we want, this was discussed with @naps62 especially for cases where the value ends in x.33(3). What do you guys think it's expected here? 18 decimals?

@zamith
Copy link
Member

zamith commented Apr 20, 2022

Both seem fine to me, was just raising the points to ensure it had been considered.

@naps62
Copy link
Member

naps62 commented May 4, 2022

@rafaelcruzazevedo one note from what I'm noticing above: formatUnits(...).toString() is redundant. the first one already gives you a strinig

@naps62
Copy link
Member

naps62 commented May 5, 2022

Another issue I'm noticing, both in these checklist, and in the code:
you're using formatUnits, which is the intended idea. But just like parseUnits it also takes a 2nd optional argument with the number of decimal places (18 by default, but should be 12 for aUsd)

So for example, instead of formatUnits(price.toString()) (as it is in the code right now), you should do formatUnits(price, await aUsd.decimals())

@naps62 naps62 added the web label May 9, 2022
@naps62
Copy link
Member

naps62 commented May 10, 2022

@flaviocastro chain ID for production (karura) is 686, as specified here https://evmdocs.acala.network/network/network-configuration#karura-main-network

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed web
Projects
None yet
Development

No branches or pull requests

3 participants