Snippets

chromawallet Mortgage Deed Sub Contract

Created by LudvigOberg last modified
(defcontract mortgage_deed_sub_contract ()
  (fields
      (sellers_bank :type pubkey :init nil)
      (buyers_bank :type pubkey)
      (land_registry :type pubkey :init nil)
      (future_deed_holder :type pubkey :init nil)
      (future_second_hand_deed_holder :type pubkey :init nil)
      (current_deed_holder :type pubkey :init nil)
      (buyer :type pubkey :init nil)
      (buyer_1 :type pubkey :init nil)

      (property_ID :type string :init nil)
      (deed_amount_buyers_bank :type integer :init nil)
      (deed_amount_future_deed_holder :type integer :init nil)
      (contract_date :type integer :init nil)
      (aktnummer :type integer :init nil)
      (state :type string :init nil))
      
  (actions

    (intiate ((land-registry-pk pubkey) (sellers-bank-pk pubkey) (future-deed-holder-pk pubkey) (future-second-hand-deed-holder-pk pubkey) (current-deed-holder-pk pubkey) (buyer-local-pk pubkey) (buyer-1-local-pk pubkey))
        "Invite Land registry, Sellers bank, deed holders and buyers"
     (guard
        (signatures buyers_bank)
        (eql state nil))

    (locally
        (invite land-registry-pk 
                sellers-bank-pk
                future-deed-holder-pk
                future-second-hand-deed-holder-pk
                current-deed-holder-pk
                buyer-local-pk
                buyer-1-local-pk))
                
    (update land_registry land-registry-pk
            sellers_bank sellers-bank-pk
            future_deed_holder future-deed-holder-pk
            future_second_hand_deed_holder future-second-hand-deed-holder-pk
            current_deed_holder current-deed-holder-pk
            buyer buyer-local-pk
            buyer_1 buyer-1-local-pk
            state :set_deed-information)
       )

    (set-deed-information
        ((property-id string) (contract-date integer) (deed-amount-buyers-bank integer) (aktnummer-local integer) (deed-amount-future-deed-holder integer)) 
            "Input property id, contract date, deed amount and aktnummer" 
      (guard
          (signatures buyers_bank)
          (eql state :set_deed-information)
          (eql property_ID nil)
          (eql deed_amount_buyers_bank nil) 
          (eql contract_date nil)
          (eql aktnummer nil)
          (eql deed_amount_future_deed_holder nil)
          (eql aktnummer nil)
        )
      (update property_ID property-id
          contract_date contract-date
          deed_amount_buyers_bank deed-amount-buyers-bank
          deed_amount_future_deed_holder deed-amount-future-deed-holder
          aktnummer aktnummer-local
          state :intiate-deed-transfer)
    )
          
      (intiate-deed-transfer ()
        "Buyer bank intiates deed transfer"
      (guard
          (signatures buyers_bank)
          (eql state :intiate-deed-transfer))
      (update state :buyer-approve-deed-transfer)
      )
      
      (buyer-approve-deed-transfer ()
        "Buyers approves deed transfer"
      (guard
          (signatures buyer)
          (eql state :buyer-approve-deed-transfer))
      (update state :buyer-1-approve-deed-transfer)
      )
      
      (buyer-1-approve-deed-transfer ()
        "Buyer 1 approves deed transfer"
      (guard
          (signatures buyer_1)
          (eql state :buyer-1-approve-deed-transfer))
          (update state :sellers-bank-approve-transfer)
          )
          
      (sellers-bank-approve-transfer ()
        "Sellers bank approve deed transfer"
      (guard
          (signatures sellers_bank)
          (eql state :sellers-bank-approve-transfer))
          (update state :future-deed-holder-approves-transfer)
          )
          
      (future-deed-holder-approves-transfer ()
        "future deed holder approve deed transfer"
      (guard
          (signatures future_deed_holder)
          (eql state :future-deed-holder-approves-transfer))
          (update state :current-deed-holder-approve-deed-transfer)
          )
          
     (current-deed-holder-approves-transfer ()
        "Current deed holder approve deed transfer"
      (guard
          (signatures current_deed_holder)
          (eql state :current-deed-holder-approve-deed-transfer))
          (update state :land-registry-process-deed)
          )
          
     (land-registry-process-deed ()
        "Land registry sets deed as pending"
      (guard
          (signatures land_registry)
          (eql state :land-registry-process-deed))
          (update state :land-registry-set-deed-as-pending)
          )
          
     (land-registry-denies-deed ()
        "Land registry denies deed"
      (guard
          (signatures land_registry)
          (eql state :land-registry-process-deed))
          (update state :deed-denied)
          )
          
    (land-registry-approves-deed ()
        "Land registry approves deed"
      (guard
          (signatures land_registry)
          (eql state :land-registry-set-deed-as-pending))
          (update state :deed-has-been-approved)
          )
   
))

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.