Demo: Escrow Contract Marketplace for Hedging & Wagering

I would like to build a dapp, hosted for people to actually use, that serves as a simple demonstration of API3 tech. I’ve been brainstorming but I would love some feedback and ideas from the community.

The goals would be

  • Simple, minimal code. The purpose is to demonstrate using API3 tech in a real-world dapp so the smart contract should only be as complicated as it needs to be to achieve that.
  • Actually useful. I’d like it to be something with real-world value. Not just a contrived example.
  • Interesting to use. It should be something that people find interesting and maybe even fun.
  • The code could be used as a template for similar dapps.
  • Not just gambling. While a gambling app could be fun, I would like to portray a more positive image. It should reduce risk, not just be a game of chance.

I’m thinking it could be a market where people can buy something like peer-to-peer insurance based on derivatives from Web3 APIs. There would be buyers who want to hedge against a future negative circumstance and sellers who want to cover the risk for a premium. Both parties would send their assets (premium and payout) to the contract, which would be held there until the outcome is known. If the negative event occurred the buyer would get the assets. Otherwise the seller would get the assets.

Some additional thoughts are

  • It could be done so the asset being traded is API3 tokens, since the purpose of this is demonstration and marketing for API3. There are pros and cons to this. Not sure.
  • A variety of derivatives could be used as parameters to decide the outcome. Some examples might be weather, asset prices, election results, sporting events, etc… The buyer and seller would have to agree on the criteria when the deal is made.
  • It would be nice to demonstrate use of both Web3 APIs (basic RRP) and Beacons (data feeds). Although I’m not sure how Beacons might fit in yet.
  • I’d like to actually run it on a mainnet. Maybe Polygon, BNB, or RSK. It would have to be audited but if the code is simple and minimal that shouldn’t be too hard. The use case is very simple. There is no pooling, fractional reserve or need to worry about solvency.

So that’s the idea. I would love your feedback. Does this seem like a smart way to demo and showcase API3? What are your thoughts on the details? Do you have a better demo idea we should consider instead?

How about a wager app, where two people can bet on the outcome of some scenario e.g. a sports result, weather, whatever. The wager funds are placed in escrow, and the api3 Airnodes are used to retrieve the result.

1 Like

At its core that’s exactly what I’m proposing. The difference is in how it’s framed. A hedging app would be 2 parties betting on something that offsets real-world risk for the buyer. The amount being put into escrow by the buyer is the premium and the parties would have to agree on it based on what they believe are the odds of the negative event occurring.

I’m thinking presenting it as hedging or insurance would appeal more to mainstream businesses because it implies it’s being used for good (ie offsetting risk of a drought for a farmer) rather than just betting on things for gains.

Do you think presenting it as wagering would work better? I do want it to be used a lot.

I think it depends on your objective - if the most important thing is the app has high usage the degen crypto communities may be easier to onboard to a new app but they’d want something fun, if you’re targeting business users agreed wagering might be perceived negatively but established businesses may also take more persuading to use the new service.

That’s a good point. We could even do both. The same contracts can handle both use cases so we could host 2 frontends. One would present it as hedging for offsetting risk and one would be betting for fun. It would also demonstrate how there are multiple applications for the escrow contract template.

Trustswap have a quite well established escrow service, I don’t think it’s automated using real world data. Might be worth reaching out and seeing if there’s some synergy :+1:

I’ll have a think of fun stuff for the degen community other than standard wagering

I should have mentioned I would like to have multiple demo dapps. So we need to pick one to do first but it doesn’t mean we can’t do the others eventually. Other ideas are welcome. Can you put them each in a new topic and keep this topic just about the wagering/hedging escrow contract idea?

I’ve been hacking on something very relevant/similar here

It’s a two-party prediction market judged by an Airnode RRP call, where the offeror escrows ERC20 tokens and if the offeree (designated by the offeror) accepts, the same amount of tokens is transferred by them to the smart contract escrow, pending the Airnode response. It’s still a bit of a work in process, but could be tweaked for an interesting demo dApp

1 Like

Awesome, I’ll take a look. So far the idea has had all positive feedback so we’ll move forward with it. @Erich you’re more than welcome to contribute or just provide feedback as we go.

2 Likes