Coinsence / meta

General Info and Improvement Proposal repository
1 stars 0 forks source link

Disabling or cancellation of crowd funding campain vs closing or accepting investment #113

Closed KarimChabrak closed 4 years ago

KarimChabrak commented 5 years ago

User shall be able to disable or cancel a crowd funding campain.

In this case, all related transactions shall be reversed.

To ensure that this is possible.

Closing a campain means commit from campain initiator to start project. This action can be initiated either during the campain or latest 3 days after campain deadline. Is nothing happens after deadline, campain is cancelled and investment are reversed.

As long campain is ongoing, Investor shall also be able to revert his investment.

gdalyy commented 5 years ago

cc @pcP1r4t3

KarimChabrak commented 4 years ago

Maybe we should first only implement following.

User can only transfer coins from funding account when they select "accept investment".

As long they did not "accept investment", they can "Cancel campaign".

So two alternatives:

3 days after deadline, campains are cancelled in case user do not click on accept invest.

KarimChabrak commented 4 years ago

Following use case fails: User A invests in space ABC and gets ABC coins. Then he sends X ABC coins to user B.

When space ABC cancels the campaign,

image

  1. in /var/www/coinsence_dev/protected/modules/xcoin/widgets/AssetDistribution.php at line 48 39404142434445464748495051525354555657 $id = $contentContainer->contentContainerRecord->id;

        if (!isset($result[$id])) {
            $result[$id]['record'] = $contentContainer;
            $result[$id]['balance'] = 0;
        }
    
        $result[$id]['balance'] += $balance->balance;
        $result[$id]['percent'] = round(($result[$id]['balance'] / $issuedAmount)*100,4);            
    }
    
    usort($result, function ($a, $b) {
        return $b['balance'] - $a['balance'];
    });
    
    return $result;

    }

  2. in /var/www/coinsence_dev/protected/modules/xcoin/widgets/AssetDistribution.php at line 48 – yii\base\ErrorHandler::handleError(2, 'Division by zero', '/var/www/coinsence_dev/protected...', 48, ...) 42434445464748495051525354 if (!isset($result[$id])) { $result[$id]['record'] = $contentContainer; $result[$id]['balance'] = 0; }

        $result[$id]['balance'] += $balance->balance;
        $result[$id]['percent'] = round(($result[$id]['balance'] / $issuedAmount)*100,4);            
    }
    
    usort($result, function ($a, $b) {
        return $b['balance'] - $a['balance'];
    });
  3. in /var/www/coinsence_dev/protected/modules/xcoin/widgets/AssetDistribution.php at line 25 – humhub\modules\xcoin\widgets\AssetDistribution::getDistributionArray(humhub\modules\xcoin\models\Asset) 19202122232425262728293031 @var Asset / public $asset;

    public function run() { return $this->render('asset-distribution', ['distributions' => self::getDistributionArray($this->asset)]); }

    public static function getDistributionArray(Asset $asset) { $result = [];

  4. in /var/www/coinsence_dev/protected/humhub/components/Widget.php at line 58 – humhub\modules\xcoin\widgets\AssetDistribution::run() 52535455565758596061626364 ob_implicit_flush(false); try { / @var $widget Widget / $widget = Yii::createObject($config); $out = ''; if ($widget->beforeRun()) { $result = $widget->run(); $out = $widget->afterRun($result); } } catch (\Exception $e) { // close the output buffer opened above if it has not been closed already if (ob_get_level() > 0) { ob_end_clean();

  5. in /var/www/coinsence_dev/protected/modules/xcoin/views/overview/index_space.php at line 55 – humhub\components\Widget::widget(['asset' => humhub\modules\xcoin\models\Asset, 'class' => 'humhub\modules\xcoin\widgets\Ass...']) 495051525354555657 <?php endif; ?>

<?= Yii::t('XcoinModule.overview', 'Asset distribution') ?>

$asset]) ?>

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/View.php at line 336 – require('/var/www/coinsence_dev/protected...')

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/View.php at line 254 – yii\base\View::renderPhpFile('/var/www/coinsence_dev/protected...', ['asset' => humhub\modules\xcoin\models\Asset])

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/View.php at line 156 – yii\base\View::renderFile('/var/www/coinsence_dev/protected...', ['asset' => humhub\modules\xcoin\models\Asset], humhub\modules\xcoin\controllers\OverviewController)

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/Controller.php at line 384 – yii\base\View::render('index_space', ['asset' => humhub\modules\xcoin\models\Asset], humhub\modules\xcoin\controllers\OverviewController)

  • in /var/www/coinsence_dev/protected/modules/xcoin/controllers/OverviewController.php at line 25 – yii\base\Controller::render('index_space', ['asset' => humhub\modules\xcoin\models\Asset]) 19202122232425262728293031 {

    public function actionIndex() { if ($this->contentContainer instanceof Space) { return $this->render('index_space', [ 'asset' => AssetHelper::getSpaceAsset($this->contentContainer) ]); } else { return $this->render('index_profile', [ 'isOwner' => ($this->contentContainer->id === Yii::$app->user->id) ]); }

  • humhub\modules\xcoin\controllers\OverviewController::actionIndex()

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([humhub\modules\xcoin\controllers\OverviewController, 'actionIndex'], [])

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/Controller.php at line 157 – yii\base\InlineAction::runWithParams(['cguid' => '665f6b32-8442-41bf-b999-33186e1d...'])

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/Module.php at line 528 – yii\base\Controller::runAction('', ['cguid' => '665f6b32-8442-41bf-b999-33186e1d...'])

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/web/Application.php at line 103 – yii\base\Module::runAction('xcoin/overview', ['cguid' => '665f6b32-8442-41bf-b999-33186e1d...'])

  • in /var/www/coinsence_dev/protected/vendor/yiisoft/yii2/base/Application.php at line 386 – yii\web\Application::handleRequest(humhub\components\Request)

  • in /var/www/coinsence_dev/index.php at line 25 – yii\base\Application::run() 19202122232425 require(DIR . '/protected/humhub/config/web.php'), (is_readable(DIR . '/protected/config/dynamic.php')) ? require(DIR . '/protected/config/dynamic.php') : [], require(DIR . '/protected/config/common.php'), require(DIR . '/protected/config/web.php') );

  • (new humhub\components\Application($config))->run();

    $_GET = [ 'cguid' => '665f6b32-8442-41bf-b999-33186e1d6953', ];

    $_COOKIE = [ '_ga' => 'GA1.2.2072806533.1572216227', 'language' => '28f9aee69c73fe32d234f9e94a311c2fe9d4f0218af03c353dd6212936ea837ca:2:{i:0;s:8:"language";i:1;s:2:"fr";}', '_identity' => 'd10b88d65e027f1828a2db7e02a9ea276a521081bbdd504a35a93f8e9bef28fda:2:{i:0;s:9:"_identity";i:1;s:51:"[13,"050c9a18-3cc0-45a5-838b-3b20bf02da09",2592000]";}', 'PHPSESSID' => 'kiebus2jp17t5v8rir8i6eohqs', '_csrf' => '30c29b76cc012d4c373806afb830fefc7953913383e8b84e244251561770ffa4a:2:{i:0;s:5:"_csrf";i:1;s:32:"AgfZWa7Q2gxBypAsKxtkdnIiQb_nvSMV";}', 'pm_getting-started-panel' => 'expanded', 'pm_panel-activities' => 'expanded', 'BCSI-CS-a414110a74a26a8a' => '2', ];

    $_SESSION = [ 'flash' => [], 'id' => 13, '__expire' => 1574201410, 'user.canSeeAdminSection' => false, 'live.poll.lastQueryTime' => 1574200009, ];

    KarimChabrak commented 4 years ago

    I propose to make the buttons "cancel campaign" and "accept investment" more accessible to user and not hide them under the "Edit" button.

    See here

    image

    KarimChabrak commented 4 years ago

    @gdalyy

    When campain is cancelled, the funding account and the issued coins disappear.

    In blockchain this is a bit complex (burning mintet ERC20 token).

    I propose to not remove the funding account. Just leave this account with the issued coin in the space. Space admin can transfer them somewhere else and use them for other purpose.

    KarimChabrak commented 4 years ago

    When accepting investment,

    1. The campaign is removed from public crowdfunding place.
    2. The campaign is still visible in the space, people can still invest and all button in the top disappear.

    I propose that campain is still visible also in the public funding place after accepting invest. User need to close the campain manually.

    After "Accepting investment" User has only one button called "Close campaign". When he clicks on it, the campaing is closed, which means

    KarimChabrak commented 4 years ago

    @gdalyy

    REGARDING BLOCKING INVESTOTR TRANSACTION.

    Here we have to take care not to completely block the investor account.

    The problem, as we are using Blockchain, we can not prevent the transaction except we implement the whole process as smart contract.

    This issue is not urgent, as currently user are investing from ccc space and they can not make direct transactions. Maybe we can open here a new issue and leave it for a later stage.

    To avoid -X balance, maybe check investor balance first and then send back only what is still available. .

    KarimChabrak commented 4 years ago

    Dear @gdalyy

    I will close this issue. The 2 new issue which are not urgent will be created as separate issues: https://github.com/Coinsence/meta/issues/159 https://github.com/Coinsence/meta/issues/160