How Can We Model a Building in Web3? (Continued)


By Nadine Loepfe
Missed Part 1? Read up on it here, or catch the big-picture REIT architecture deep dive here.
A real property is an economic organism, and should be able to:
Raise capital from investors
Earn rent
Pay invoices
Let users vote
That’s why our accelerator treats each asset as a mini‑dApp consisting of several contracts. The NFT as discussed in our previous blog post is just the tip of the iceberg. Underneath the surface, yet equally as important to making the tokenized property function effectively, we have:
Fungible building token “shares” that legally represent fractional ownership
A Vault and Treasury to route cash (we’ll deep‑dive those next time)
A Governance Governor so shareholders have a voice
In this article, we’ll explore each of these aspects individually, including the factory contract that ties all these pieces together. By the end, you’ll understand that a building isn’t one NFT at all; you will learn that it’s a pocket‑sized application that mints its own equity, keeps a tight cap‑table, and lets investors approve new air‑conditioning through a smartphone, as well as how the BuildingFactory stitches them together in one atomic deployment.
Why Every Building Needs a Factory
A property must be able to raise capital, earn rent, pay invoices, and let owners vote.
The BuildingFactory
launches all four contracts that make that possible:
After completion, the property is fully operational on‑chain: equity exists, a voting mechanism is in place, and future upgrades can be performed without migrating contract addresses.
As we’ve already discussed the newBuilding() call last time, lets dive in where we left off:
Minting the Building Token (ERC-3643)
The building’s equity is divided into small, identical units. Anyone who passes KYC can purchase the exact exposure they want - ten dollars or ten million dollars - and trade those units around the clock. You can own 13.42% of a building and trade it at 3AM.
Also, with fungible tokens, investors can calibrate risk - for example, allocating 2% in a Chicago apartment, 5% in a Lisbon hotel - rather than making an all‑or‑nothing bet on one deed.
Regulated tokens in a nutshell
As a reader of this series, you already know of the advantages of using a regulated token standard. Instead of a vanilla ERC‑20, we plan to use ERC‑3643: a permissioned, compliance-aware token standard born out of Tokeny’s T‑REX framework and an official Ethereum Improvement Proposal.
Why? Because real‑estate securities must obey KYC/AML, investor caps, and geo‑fences. ERC‑3643 bakes those rules directly into every transfer, letting a token “refuse” to move when compliance checks fail - no central operator required. That’s why >$28 B in RWAs already use it.
In the BuildingFactory contract, this is how this looks like in code:
function newERC3643Token(
address building, // proxy created by newBuilding()
string memory name, // e.g. "123-Main-St Shares"
string memory symbol, // e.g. "BLDG-123"
uint8 decimals // usually 6 or 18
) external onlyBuildingOwner(building)
{
// 1. Ensure we haven't minted shares yet
require(
_getBuildingFactoryStorage()
.buildingDetails[building].erc3643Token == address(0),
"Token already exists for this building"
);
// 2. Call Tokeny TREX Gateway → returns a fully-compliant ERC-3643
address token = BuildingToken.createERC3643Token(
$.trexGateway,
building, // controller = the building proxy
name,
symbol,
decimals
);
// 3. Hand ownership to the sponsor (msg.sender)
OwnableUpgradeable(token).transferOwnership(msg.sender);
// 4. Store address so Treasury & Governor can reference it later
$.buildingDetails[building].erc3643Token = token;
emit NewERC3643Token(token, building, msg.sender);
}
Deploying the Vault and Treasury
Once the equity token exists, we can integrate cash-flow plumbing in two back-to-back calls:
newTreasury() – spins up a Treasury proxy and its first revenue Vault.
_deployVault() (internal) – issues an ERC-4626/7540 staking vault for the building’s own share-token.
The Treasury holds reserves, pays invoices, and forward-routes rent to token-holders, while the Vault lets investors stake tokens and collect yield (e.g. rental or LP fees).
Code excerpt:
address treasury = _deployTreasury(reserve, highWater, msg.sender);
address vault = _deployVault(token, msg.sender, treasury);
ITreasury(treasury).addVault(vault);
details[building].treasury = treasury;
Voting with Building Governor
Most public ‑market REIT investors have little to no operational influence: they receive quarterly statements and trust the management team to execute. In our on‑chain model, we take a different view: anyone who owns Building tokens as “shares” should be able to approve material actions - directly, transparently, and without intermediaries.
To provide that agency, the Building Factory deploys a dedicated governance contract every time it tokenises a property. Ownership of this contract is transferred to the DAO or multisig that initiated the deployment, and voting power is mapped to a holder’s token balance.
But what does that mean in practice?
Below is a single, concrete example - updating the building’s pet policy - showing how a text proposal moves from draft to execution.
Inline Solidity excerpts come from the BuildingGovernance contract you deploy with each property.
1. GovernorEvent: ProposalSucceeded(id);Proposal creation
The community manager (or any holder) submits a text proposal:
uint256 id = buildingGovernor.createTextProposal(
ProposalLevel.Policy,
"Allow domestic pets up to 30 lbs in residential units"
);
The contract emits ProposalCreated(id, …).
At this point, every building token holder is eligible to vote.
2. Snapshot and voting period
When the proposal is created, voting power is snap‑shotted at that block: the governor reads balances via IVotes.getPastVotes().
For the next 48 hours, holders sign For, Against, or Abstain transactions.
A front‑end can query buildingGovernor.state(id) and buildingGovernor.proposalVotes(id) to display live tallies and time remaining.
3. Proposal succeeds
Assume the final counts are 26% For, 4% Against, with quorum (1% of supply) satisfied:
GovernorEvent: ProposalSucceeded(id);
No other action occurs until someone triggers execution.
4. Execution
Because this is a “text‑only” proposal - no treasury call is attached - execution simply records the result immutably:
buildingGovernor.executeTextProposal(id);
Internally, the governor calls its generic execute(), and the chain now holds an immutable record (ProposalExecuted) that the policy change was approved.
Therefore, we have:
Direct agency — Share‑holders decided on a real expenditure, not just an advisory poll.
Clear accountability — The approved policy, vote breakdown, and execution hash are permanently stored on chain.
Try it out for yourself:
This flow can also be seen here in the example scripts of the smart contracts repository under examples/buildings/demo.
To run it, clone the repo, cd examples/buildings/demo, and run ts-node step_1.ts:
git clone https://github.com/hashgraph/hedera-accelerator-defi-eip
cd examples/buildings/demo
npm install
ts-node step_1.ts
Expected output:
The script walks through the entire factory flow:
You’ll mint the NFT, shares, Treasury, Governor, and end with delegated voting power ready for your first proposal.
Conclusion
Our architecture turns every building into a coordinated set of smart contracts:
ERC-721 + metadata URI → the digital title: pins location, floor-plans, docs in IPFS; holder address is the on-chain identity.
ERC-3643 building token → regulator-friendly, KYC-gated equity that still plugs into DeFi.
Treasury + Vault → routes rent, maintains reserves, and lets holders stake shares for yield.
Building Governor → maps token balances to on-chain voting, so investors approve policy changes and real-world spend.
Beacon pattern → single upgrade switch keeps every contract on the latest logic.
Together, they deliver a professionally governed, globally tradable real-estate instrument with transparency no traditional REIT can match.
Next in the series we’ll dive deep into cash-flow execution - how the Treasury pays bills, how the Vault distributes yield, and how payment proposals flow through governance.
Subscribe to my newsletter
Read articles from Hedera Team directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
