Subunit Docs
  • Welcome!
  • Introduction
  • Subvault
    • Subvault
      • USDC Staking
      • $STS Token issuance
      • $UNIT Token Conversion
    • Acquisition Strategy
    • Subpoints
    • Subvault Technical Docs
      • Core Functions
      • Security Architecture
  • Governance/Tokenomics
    • Introduction
    • Tokenomics
      • $SUB - Platform Token
      • $UNIT - Individual Property Tokens
      • $STS - Subvault Token Shares
      • Protocol Fees
    • Airdrops
      • Season 1
  • The Future
    • Roadmap
    • Upcoming Features
  • FAQs
    • Rental Income Flow Explained
    • Where does APY come from?
  • Legal
    • Terms of Service
  • Regulatory Pathways
  • DAO Execution Liability
  • Eligibility
Powered by GitBook
On this page
  1. Subvault
  2. Subvault Technical Docs

Core Functions

1. Staking (stake)

Users stake USDC and receive STS in return, representing a share of the vault’s USDC balance.

STS minting logic:

solidityCopyEditstsToMint = (amount * totalSupply()) / vaultBalance;
  • If totalSupply() == 0, STS is minted at a 1:1 ratio scaled by 1e12 to align with USDC decimals (6) vs. STS decimals (18).

  • Otherwise, mint proportionally to existing vault state.

Stake Details:

  • Tracked via StakeRecord[]:

    • stsShares: Amount of STS minted

    • durationDays: Lockup period (0, 90, or 180)

    • lockEndTime: Timestamp when the stake becomes redeemable

    • active: Whether the stake is still claimable

Sanctions Check:

  • Uses Chainalysis Oracle via checkSanctions(msg.sender)

  • If oracle fails or flags the address, the tx is reverted


2. Unstaking (unstake)

  • Users burn STS to redeem a share of the vault’s USDC

  • Amount returned is based on the pro-rata share of current vault balance:

solidityCopyEditusdcToReturn = (stsAmountToBurn * vaultBalance) / totalSupply();
  • Lock period must be expired (block.timestamp >= lockEndTime)

  • Stake is marked as inactive and shares zeroed out


3. Non-Transferability

STS is a non-transferable ERC20:

solidityCopyEditrequire(from == address(0) || to == address(0), "STS: token is non-transferable");
  • Transfers are blocked unless minting (from == 0) or burning (to == 0)

  • Prevents secondary market speculation and enforces 1:1 mint/burn lifecycle


4. Acquisition Withdrawals (withdrawForAcquisition)

  • Admin-only method to withdraw USDC for real estate purchases

  • This directly impacts vault balance → STS value is diluted

solidityCopyEditusdc.safeTransfer(to, amount);
emit AcquisitionWithdrawal(to, amount);

5. Rescuing Mistaken Tokens

  • Recovers any tokens mistakenly sent to vault (except USDC or STS)

  • Safeguard against misrouted assets or phishing

solidityCopyEditrequire(tokenAddress != address(usdc));
require(tokenAddress != address(this));

6. Oracle Management (setSanctionsOracleAddress)

  • Updates the sanctions oracle used for address screening

  • Emits SanctionsOracleUpdated


7. Pause Mechanism

  • pause() and unpause() let the owner halt operations during threats

  • Uses OpenZeppelin’s Pausable modifier

View Functions

Function
Description

getTotalVaultedUSDC()

Returns the current USDC balance of the vault

getCurrentValueOfActiveStakes(user)

Calculates user’s total USDC share based on active STS

getUserStakeRecordsPaginated(user, cursor, limit)

Returns paginated view of user's stake records

getUserStakeCount(user)

Total number of stakes recorded by the user

getStakeRecord(user, index)

Returns the full struct for a given user stake


PreviousSubvault Technical DocsNextSecurity Architecture

Last updated 15 days ago