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

Feature/erc20enterprise #377

Merged
merged 22 commits into from Oct 25, 2021
Merged

Feature/erc20enterprise #377

merged 22 commits into from Oct 25, 2021

Conversation

alexcos20
Copy link
Member

@alexcos20 alexcos20 commented Oct 23, 2021

Changes proposed in this PR:

  • Add allowedSwapper (type address) parameter to FixedRateExchange and Dispenser. if this is set, only a certain address (or smartcontract) can buy 1DT(for fixedrate) or request 1 DT (dispenser). Also, this parameter can be changed by owner at any time. (Usage reason: below)
  • ERC20Enterprise Template:
      • Not allowed to create pools
      • Can create FixedRateExchange and/or Dispensers (both with mint roles), setting the allowedSwapper to that particular DT address (itself)
      • StartOrder functions BURNS the DT, instead of sending it to the publisher (or revenueAccount)
      • Introduce 2 new functions:
          • buyFromDispenserAndOrder: in one single transaction, mints a DT (Dispenser does this), uses it (generates order event) and burns the DT
          • buyFromFreAndOrder: in one single transaction, buys a DT from FixedRateExchange, uses it (generates order event) and burns the DT

this closes #365, because DT never flows in wallets.

Since the FixedRate and Dispenser have a allowedSwapper set, it means nobody else can get tokens, except the ERC20Enterprise, which has no public buy functions (only buy & use above) -> no one can get tokens in their wallet

Fee structure remains the same. Following fees are allowed:

  • publishMarketFees (token, amount (absolute value in WEI), address)
  • swapFee (percentage, address to receive the fees)
  • consumeMarketFees (token, amount (absolute value in WEI), address)

@trentmc - I need your opinion on this. ^

  • Fixes address.json, by having multiple templates addresses stored ( key is templateId, value is templateAddress)

@alexcos20 alexcos20 self-assigned this Oct 23, 2021
@alexcos20 alexcos20 marked this pull request as ready for review October 23, 2021 17:07
@alexcos20
Copy link
Member Author

Still need to write tests just to make sure we have them and coverage is good, but smartcontracts are ready

@alexcos20 alexcos20 added the Status: DoNotMerge Don't merge this PR label Oct 23, 2021
@trentmc
Copy link
Member

trentmc commented Oct 23, 2021

I think this is a great idea!! Solves a challenging issue for enterprises & token-conservative jurisdictions without breaking the integrity of datatoken concept. 💯.

And the fact that you went from idea to first-class implementation in days, 👏👏.

@alexcos20 alexcos20 removed the Status: DoNotMerge Don't merge this PR label Oct 24, 2021
@alexcos20
Copy link
Member Author

alexcos20 commented Oct 24, 2021

@srikanthkaja31 @soonhuat - this solves your requests as well. And cool thing is that you create two active fixedrates for the same asset:

  1. ask 5 USDT and have fees of 2%
  2. ask 4 EUR and have fees of 1.8 %
    consumer can choose which one to use.

(In order to achieve this, you must set publishMarketFees and consumeMarketFees to zero, and let only swapFees)

@TimDaub
Copy link

TimDaub commented Oct 25, 2021

As the creator of #365, I can confirm that this addresses my requirements. I'll have to dive a bit deeper to understand it perfectly but for now, we at RPI are stoked to see this land in V4. Thanks, @alexcos20 et al. 🎊

@alexcos20 alexcos20 merged commit 9b6785c into v4main Oct 25, 2021
3 checks passed
@alexcos20 alexcos20 deleted the feature/erc20enterprise branch October 25, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants