cryptonative-ch / aqua-js

AquaJS gives you access to the Mesa ecosystem in a single package
GNU Affero General Public License v3.0
2 stars 1 forks source link

close and withdraw funds of a finished fixe price sale #20

Closed martinkrung closed 3 years ago

martinkrung commented 3 years ago

closeSale()

https://github.com/cryptonative-ch/mesa-smartcontracts/blob/26a59272a7014c41dbb88616b9fa0736ef1a94b8/contracts/sales/FixedPriceSale.sol#L193

than

widhdrawFunds()

withdrawUnsoldFunds()

https://github.com/cryptonative-ch/mesa-smartcontracts/blob/26a59272a7014c41dbb88616b9fa0736ef1a94b8/contracts/sales/FixedPriceSale.sol#L291

Detailed Description

Use this sale to test, this sale is over the threshold

https://www.mesa-ui.dev/sales/0x180ae151e9683377d36c13e74077b0e8f63607e9

Possible Implementation

Use this as an inspiration:

https://github.com/cryptonative-ch/mesa-js/blob/main/examples/create-fixed-price-sale.ts

Here a guide how to use this: https://github.com/cryptonative-ch/mesa-js/blob/main/examples/create-fixed-price-sale.md#how-to-run-create-fixed-price-salets

Extended Task

What we also would need and could also be done is an output/report.

Which address did buy how many token?

Maybe not possible after the sale, if somebody withdrew already. Close is also executed on releaseTokens() if tokenIn back to investors if threshold not reached.

Claimed/Unclaimed token to find out how many tokens are still in the contract?

Check if sale is over or under threshold and then to the right thing

Add a test if the sale is under or over the threshold and then do different things/report.

adamazad commented 3 years ago

I don't see the reasons why the SDK needs this multi-call. What am I missing? Both closeSale and withdrawFunds methods are available on the FixedPriceSale contract interface.

On a side note, this might require a bot that actively checks for sales on the network and closes them.

rossneilson commented 3 years ago

Should this just be a UI button only visible for the owners?

adamazad commented 3 years ago

Should this just be a UI button only visible for the owners?

That’s a more plausible idea. As transaction fees are cheap, there could be a bot funded by the Mesa treasury, that checks sales from the subgraph to close them.

adamazad commented 3 years ago

Let’s keep it dead simple for now.

martinkrung commented 3 years ago

@adamazad

I think what you miss is that we don't have a place where we/I or anybody can just call a script which then does these things. Ofc there is a way to this over commands line right how to do. But I don't know right now.

At the end this stuff should be with a UI in the dashboard, but right now, we don't have a dashboard. My vision is to build up tools for this where we can test things out over cli. I don't think we should build too many things into the investor facing interface.

What I would also like is some form of reporting because at the end we need this in the dashboard too and right now, this would also enable us to pay back funds

This repo may be not the right place, but I don't think we should add the overhead of work on dashboard with UX right now.

At the end I try to add transparency and as code speaks much more than documentation my aim is to use code for this.