RigoBlock / contracts

[DEPRECATED] directory of our contracts
Apache License 2.0
1 stars 0 forks source link

restructure subscription/redemption fee as a module #26

Closed gabririgo closed 6 years ago

gabririgo commented 6 years ago

when a fee is set, the transformation is incorrect

function setTransactionFee(uint _transactionFee) only_owner { data.transactionFee = safeDiv(_transactionFee, 10000); //fee is in basis points (1bps=0.01%) }

the fee calculation is incorrect as well uint fee = safeMul(gross_amount, data.transactionFee); uint fee_drago = safeMul(fee, admin.ratio) / 100;

the correct code would be: uint fee = safeMul(gross_amount, data.transactionFee); uint fee_drago = safeMul(fee, admin.ratio) / 100 / 10000;

the first expression should be: function setTransactionFee(uint _transactionFee) only_owner { data.transactionFee = _transactionFee; //fee is in basis points (1bps=0.01%) }

as any fee should be a multiple of 10000 anyways

a transaction fee adds costs to the contract, but at the same time allows to create a distribution mechanism. This potentially qualifies us and the manager as distributors (potential regulation) but opens the way for fund disribution, which could make sense in commercial terms.

we have to analyse the tradeoff and check if there is an alternative way of rewarding a distribution

gabririgo commented 6 years ago

a possible improvement would be to calculate the fees in a fee module and create a distribution mechanism.

This is a potential RBIP, as the further improvement would not necessary possilble for the release

gabririgo commented 6 years ago

AMEND: if we created a module "distribution" on top of the protocol, we could allow distributors to buyonbehalf or users to buy on distributors' platforms. AND we could take the fees away from the protocol, which would protect it from any regulatory issue

gabririgo commented 6 years ago

WIP, created Distribution.sol , which is an example of how anyone can use the module to be a distributor of funds and earn a distribution fee on inflows..setting the same fee for outflows would be potentially harmful, as the distributor would have an incentive to cause outflows. Useful for third party integration, simplification of code of funds and more modular design

gabririgo commented 6 years ago

implemented both corrected fees in vaults and distribution module for distributors, external fee calculations will make the contract call more expensive, hence will close for now. Internal subscriptions/redemptions fees will be taken out only if the drago cannot handle them for total size matters, otherwise we are leaving it there for now