Introducing blockimmo’s platform smart contracts v2

This post serves as supplemental documentation for our upcoming audit with a well known blockchain security firm. After the audit’s completion, v2 source code will be pushed to our gitlab and considered in scope for our on-going bug bounty program.

Smart Contracts of blockimmo — v2 January 2019

v2 introduces the following new features:

  • Funds are stored in an ERC20 (currently the DAI stable coin) across all smart contracts (previously Ether)
  • Implemented a PaymentsLayer that integrates the Kyber protocol to enable payments in Ether as well as other ERC20 tokens, converting to DAI under-the-hood instantly and with no transactional risk
  • Enabled payments in FIAT via PayPal Checkout, greatly reducing the barrier-to-entry for first-time users
  • Implemented an Escrow that integrates the Compound.finance protocol. All smart contracts that raise/store funds supply Compound’s Money Market as DAI comes in, and withdraw from the Market as DAI is pulled out — earning interest on funds held in escrow
  • Updated all smart contracts to OpenZeppelin v2 and Solidity 0.5.x
  • Refined and simplified our platform with many minor improvements we’ve identified since our Mainnet launch (in September 2018)
Preview of STX.SWISS / blockimmo.ch payment module v2

DAI

Ether’s volatility was turning out to be a major roadblock in listing real properties on our platform. A single percentage point can be the difference between a successful and bad investment in the real estate investment space, and therefore we needed a way to offer both sellers and investors a stable means to conduct these transactions. This seems to be the case for most assets/securities, in addition to real estate.

Dai is a stable coin implemented as an ERC20 token on the Ethereum blockchain. Designed to maintain 1:1 parity with the US Dollar, its value is backed by collateral (Ether). Dai is an asset-backed, hard currency for the 21st century — it is designed to maintain a stable value, without borders and restrictions.

https://makerdao.com/en/

By migrating to Dai as the internal currency of our platform we guarantee price-stability to both investors and sellers.

  • Sale: When listing a property for sale on our platform, sellers define the property’s price in USD. Upon the sale’s successful completion, the DAI raised is transferred directly to the seller’s wallet. The seller is free to exchange DAI to FIAT at their convenience. The seller is never exposed to price volatility risk.
  • Dividends: Commercial properties generate income in FIAT. This income is distributed to the property’s owners through our smart contracts, in DAI. This is a simple process where the property’s management company deposits the DAI into the TokenizedProperty, and the property’s owners can then pull their share of the dividend payout at any point in time (non-expiratory). The property owners are never exposed to price volatility risk between the time dividends are paid out and claimed.
  • Secondary market: Tokens of property can be traded on the secondary market for DAI. Traders are never exposed to price volatility risk between the time they extend a buy/sell order and it’s filled (or deleted/expires).

We can easily configure our smart contracts to accept a different ERC20 (i.e. WBTC or XCHF) if we choose to in the future. In no way are we tied to DAI.

PaymentsLayer (Kyber)

Although DAI is the internal currency of our platform, we enable payments in native Ether and a variety of tokens. We expect most users to continue investing with Ether, and this keeps the UX simple as the user doesn’t need to do any conversion on their own as this happens automatically. This conversion occurs instantly (no waiting for orders to be matched) and securely (no middlemen or transaction risk).

We’ll even accept bitcoin soon!

This PaymentsLayer can be used with any of our smart contracts, whether investing in the initial sale, paying dividends, or trading on the secondary market.

PayPal Checkout

We integrated PayPal Checkout into our frontend to enable payments in FIAT in an effort to reduce the barrier-to-entry for first-time users. Users will still need to setup their wallet for login/on-boarding, and as they receive tokens:

Migrating to DAI as the internal currency of our platform made accepting FIAT much more practical. Accepting FIAT easily cuts the number of steps to a newcomer’s first transaction in half. All they need to do now is setup their wallet — no need to on-board to an exchange, convert FIAT to Ether, and withdraw this to their wallet. We hope to be a gateway for many future crypto users!

Escrow (Compound.finance)

Token sales are long running (on the scale of months), investors have no time-limit to claim dividends, and a liquid secondary market means many open buy orders at any given point in time. In all these cases our smart contracts hold DAI securely in escrow.

Therefore, any of our smart contracts storing funds inherits from an Escrow that integrates the Compound.finance protocol. Escrow supplies Compound’s Money Market as DAI comes in, and withdraws from the Market as DAI is pulled out — earning interest on value that would otherwise just sit in escrow.

Because borrowers are over-collateralized and the Compound protocol maintains excess liquidity, our Escrow operates on a set of safe guarantees. The result is a revenue stream from interest which is accumulated block-by-block (per-block interest rate based on supply and demand).

Software Updates

Updated all smart contracts to the most recent release of OpenZeppelin and Solidity. This has led to general all-around improvements and simplifications.

Iterating

We’ve identified a few improvements and pain-points since our Mainnet launch (in September 2018) from usage data and user feedback. Some examples:

  • Allow dividends/refunds/tokens to be pulled to a user. So while it is still impossible for anyone to pull assets that don’t belong to them to them, if a user is struggling (for whatever reason) another account can trigger the assets to be transferred to the user they belong to (a common support case)
  • Improve the interfaces our smart contracts expose so an even more friendly UI/UX can be built around them in our DApp

This post summarizes the changes between v1 of our platform smart contracts (currently live) and v2. It is intended to serve as supplemental documentation for our upcoming audit and any hackers participating in our bug bounty program. We will be rolling out v2 over the next two weeks.