GithubHelp home page GithubHelp logo

baedrik / scrt-sealed-bid-auction Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 4.0 466 KB

Smart contract to implement a sealed-bid-auction on Secret Network. Includes a bash script to help the user work with auctions

License: GNU General Public License v3.0

Makefile 0.50% Shell 52.02% Rust 47.49%

scrt-sealed-bid-auction's People

Contributors

baedrik avatar cankisagun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scrt-sealed-bid-auction's Issues

Closing an auction

Time to close is determined by Alice as t

  • Alice (Creator of the auction) can end the auction before t
  • Alice (creator), Bob or Charlie or any bidder (anyone) can end the auction after t

Other points:

  • Accept bids after t, if auction hasn't been closed

OTC sales with lock-up and staking

Most sales to funds / long term holders are OTC deals that involve a price discount + lock-up period for the buyer. SecretAuctions can accommodate this process, which currently is trust-based.

This would be used in liquidation SCRT Ecosystem Fund to fund USD based grants or diversify the portfolio. Here's how this would work:

  • Seller is selling X SCRT with a time_t lock up and Y% discount, in exchange for Y token (USDT, DAI, ETH, WBTC etc.)
  • Buyers bid to purchase X SCRT with lock-up.
  • The buyer also wants to earn staking income while their assets are locked up (they are unable to sell or move the purchased SCRT)

In order to accommodate for this, the auction contract would need to:

  1. convert sSCRT to SCRT and stake it (can be single validator selection in the beginning)
  2. Set a time after which the buyer address can undelegate the tokens from the validator if she/he chooses to

Future work

Next steps for secretAuction are:

  1. Add a factory contract:
    This will allow the UI to keep track of open auctions very easily, rather than scanning the entire blockchain for all auctions.

  2. Change min_bid price w/o closing the auction

  3. Variable price bids:
    We need to find a way to make sure that min. prices doesn't stay out of the money. This creates a poor experience to only see auctions where you don't want to participate. The idea would be to first add variable price bids for the seller. I would create an auction and say I'm selling at marketprice, -1% below market price, +1% market price. The lowest bid can be updated periodically (every 100 blocks etc.)
    This also requires an oracle integration (see scrtlabs/SecretNetwork#697)

  4. Auctions with a closing time (issue #5)

  5. Seller anonymity (lowest priority)

Fixed price dark pools

Fixed price dark pools allows dark pool trading (no info on order book depth or trade sizes) at a fixed price

The goal is to signal trading interest around a price, without leaking too much info about the depth of the order book and also the depth of the trades. This is done in trading sessions (say every 6 hours) for a limited amount of time (say 15 minutues). There are two processes, 1) price setting, 2) trading.

Price setting for the session can be done in two ways:

  • Participants submit desired prices and then contract takes the avg. (requires contract development) - for 10 mins before the session
  • Price API submits the bid/ask prices in Binance and the contract sets the avg. (MVP design - requires a price orace)

One the price is determined, the session starts and the price is fixed for the session - for 10-15 mins. Traders start adding their orders (buy / sell amount) in a secret contract. These inputs are private. Secret Contract creates an orderbook just based on quantity. Orders are matched on a first come / first serve basis. This process leaks no information about trade sizes or the interest to buy / sell at a given price.

The whole idea revolves around letting the market know that for this 10-15 minute window, there’ll be liquidity at a given price.

Variable auction min price and price oracles

Steps:

  1. Create a command to change the min. price of an auction
    Current approach to changes to min and existing bids
    If the min_price changes we keep any valid bid valid. This means if the min was 5 and Bob bid 6, and Alice increased min bid to 8 and there are no new bids, Bob wins the auction at 5
    Note: get feedback on this

  2. Price oracle integration - to be detailed

UI to-do

Alice comes to the website and starts an auction

  • Alice determines the contract address for the asset they want to sell and what they want to receive in return,
  • Alice determines a minimum bid they will accept.
  • Alice ends the auction manually: No end date or time set. Alice will choose to close it at some point, We need to communicate that in the UI at the moment

The UI should show all auctions in a list - like a landing page

Bob goes over the list of open auctions to bid

  • Bob chooses an option - he will query the asset being sold, asset accepted on the auction, status (accepting_bids-tokens_are_consigned/accepting_bids-tokens_are_NOT_consigned/closed)
  • Bob can make a bid
  • Bob can remove a bid (Bob can only have 1 bid per auction)
  • Bob can make a new bid - this will keep the highest bid amount and discard the lower one. If it's a duplicate bid, Bob doesn't

Alice closes to the website and starts an auction

  • Alice will close the auction by calling a function, Alice will be shown the winning amount (she doesn't know the bidder),or is shown a message if the minimum bid threshold is not met
  • If there are no active bids, Alice can decide to cancel the auction and get her tokens back or keep the auction open
  • Bob XXX - WIP

CLI instructions feedback

It would be helpful to do the following for the CLI errors / user commands

Bob's bidding in an auction

  • Insufficient funds (Low Priority):
    image
    We can prompt you have 0 balance and the minimum bid amount is 0.115

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.