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

dMarket Smart Contract #102

Open
wants to merge 9 commits into
base: hive-engine
Choose a base branch
from
Open

Conversation

ali-h
Copy link

@ali-h ali-h commented Sep 21, 2021

dMarket Smart Contract

Dynamic Market Smart Contract allows users to trade tokens with different quote tokens other than SWAP.HIVE (the original market contract). A global quote token means every token is allowed to be traded for it, only Hive Engine team can create a global quote token. There are two global quote tokens allowed by default (SWAP.BTC & BEE). More quote tokens can be added by users for 500 BEE per base token in a pair. It allows tribes and other projects to allow tokens to be traded for their native tokens (ex. DEC:PAL, ORB:PAL, BEE:PAL, SWAP.DOGE:PAL, etc..).

Transactions are similar to the original market contract with the addition of a "quoteToken" parameter.

Example: To buy BEE tokens for SWAP.BTC

{
    "contractName": "dmarket",
    "contractAction": "buy",
    "contractPayload": {
        "symbol": "BEE",
        "quoteToken": "SWAP.BTC",
        "quantity": "150",
        "price": "0.00000912"
    }
}

Complete Documentation: Here

@Rishi556
Copy link

Rishi556 commented Sep 27, 2021

only Hive Engine team can create a global pair

Why not let the witnesses decide? If a majority of top witnesses(11/20 right now) are voting for a particular token to be global, then it should be.

I say this because right now we are too dependent on the engine team and I'd like to slowly start transitioning away from that wherever possible.

contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
@ali-h
Copy link
Author

ali-h commented Sep 29, 2021

only Hive Engine team can create a global pair

Why not let the witnesses decide? If a majority of top witnesses(11/20 right now) are voting for a particular token to be global, then it should be.

I say this because right now we are too dependent on the engine team and I'd like to slowly start transitioning away from that wherever possible.

Yes, this is absolutely better fit. not very familiar with the witness contract yet, will have a peak. Perhaps a proposal kind-of system requiring vote between top 20 witnesses.

@Rishi556
Copy link

I think every witness should vote(sort of how hive witnesses vote for stuff like account creation fee/price feed) and as long as more than 50% of the top active witnesses are voting for that particular token to be a global token then it is. It's a big thing, since witness voting isn't something implemented yet, so releasing this and then updating later is always a choice. Probably will need to add a "witnessVote" action or something to the witnesses contract requiring the name of what they are voting on and the value(an array of tokens here).

My biggest goal with this is to prevent centralization to the engine team. Letting witnesses decide this helps reduce that centralization.

contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
test/dmarket.js Outdated Show resolved Hide resolved
@ali-h ali-h requested a review from eonwarped October 11, 2021 07:59
Copy link
Contributor

@eonwarped eonwarped left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index comments to resolve, otherwise LGTM

contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Outdated Show resolved Hide resolved
contracts/dmarket.js Show resolved Hide resolved
@ali-h ali-h requested a review from eonwarped October 14, 2021 11:33
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

3 participants