Coder Social home page Coder Social logo

antoniopgs / tangible Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 29.69 MB

Solidity Smart Contract implementation of an RWA (Real-World Asset) DeFi Protocol for Real-Estate Auctions & Mortgage Lending.

Home Page: https://tangible-frontend.vercel.app/

Solidity 63.59% Python 19.16% JavaScript 17.25%
ethereum decentralized-finance lending mortgages nft real-world-assets solidity

tangible's Introduction

Tangible

Introduction

Tangible is a Real-World-Asset (RWA) DeFi Protocol for Real-Estate Auctions and Mortgage Lending.
I developed it as a member of the City Builders Network of Prospera (the world's premier private city).

What Tangible accomplishes:

  • Allows lenders worldwide to earn yields, by supplying and lending their mortgage capital to the residents of a city/jurisdiction.
  • Brings mortgage access to residents of a city/juridiction (such as Prospera) who are blocked from TradFi alternatives, through the power of Blockchain and Web3.
tangible

Links

Features

  • NFTs: Legally Compliant NFTs, capable of representing RWA (property disputes can also be solved on-chain via arbitrator multisig)
  • Lending Pool: Allows anyone to supply capital to the protocol and earn yeilds from mortgages. Includes tUSDC an SEC Compliant interest-bearing token (unavailable to US Citizens)
  • On-Chain Mortgages: Gas-Efficient Amortization Schedule
  • Auctions: Bidding mechanism to allow seamless real estate transactions. A user with an active mortgage can accept a bid, sell his house, pay off any mortgage debt, and keep the difference (all in one transaction).
  • etc

Architecture

  • protocol
    • state
      • State.sol (holds all protocol state vars. the proxy and all logic contracts inherit from it, to avoid storage collisions)
      • TargetManager.sol (handles upgrade and delegatecall logic)
      • Roles.sol
    • proxy
      • ProtocolProxy.sol: (the proxy responsible for mapping each function selector to the appropriate implementation)
    • logic (all non-abstract implementations inherit from State.sol)
      • Auctions.sol
      • Borrowing.sol
      • Info.sol (originally made to contain all external getters, and reduce size of other implementations. might get rid of it. under review)
      • Initializer.sol
      • Lending.sol
      • Residents.sol (Tracks who are the legitimate residents of the jurisdiction, which are the only eligible receivers of the NFT)
      • Setter.sol (originally made to contain all external setters, and reduce size of other implementations. might get rid of it. under review)
      • interest
      • loanStatus
        • Amortization.sol (holds implementation of a flexible & gas-efficient amortization schedule)
        • LoanStatus.sol (inherits from Amortization.sol, to differentiate Active Mortgages from Defaults, and so on)
  • tokens
    • TangibleNft.sol
    • tUSDC.sol

TODOs/Fixes

  • Main
    • Add safety mechanism to protect against clashing function selectors
    • Improve state initialization
    • Finish test suite (to reach full coverage)
    • Replace PRB with my own Fixed Point Math
    • Foundry supports stateful fuzzing. Use it to replace GeneralFuzz.t.sol
    • TargetManager upgrades should be behind a dao with a timelock
    • Improve usage of environment variables
    • Improve Gas-Expensive Functions:
      • highestActionableBid() (max heap?)
      • _defaultTime() (should be able to have the user pass in the defaultTime as a param, and only have the smart contract sanity check the preceding and subsequent month)
  • Other
    • Expected vars in tests aren't being used
    • Implement foundry scripts/tasks with vm.broadcast
    • NatSpec comments
    • Improve contract and variable naming
    • Figure out how to simplify and shorten selector setting scripts
    • Slippage Protection
    • Tokenized Vault Inflation Vulnerabilities (maybe implement ERC4626)
    • Replace error strings with custom errors for gas efficiency

Future Features

  • Mortgage Refinancing
  • Fractionalization
    • Fractional Real Estate Ownership (ERC 1155 with nested mappings)
    • Ability to take out mortgage to purchase a fraction of a property
    • Build an exchange allowing users to buy in/out of real estate fractions

Frameworks

  • Foundry
  • Hardhat

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.