Skip to content

Latest commit

 

History

History
191 lines (123 loc) · 8.89 KB

README.md

File metadata and controls

191 lines (123 loc) · 8.89 KB

GitHub License devContainer


Block Foundation Logo

IFC Data

Block Foundation Smart Contract Series [Solidity]


Block Foundation Brand

Contents



Report a Bug Request a Feature Ask a Question Make a Suggestion Start a Discussion

The IFCDataContract is a Solidity-based Ethereum smart contract designed to facilitate the integration with Industry Foundation Classes (IFC) data through a decentralized oracle mechanism.

Introduction

The IFCDataContract is a Solidity smart contract designed to integrate with Industry Foundation Classes (IFC) data via an Oracle.

IFC is a data standard used widely in the architecture, engineering, and construction (AEC) industry to facilitate interoperability between different software used in these fields. The data standard encompasses various elements of building information modeling (BIM) including building elements, cost management, project management, structural elements, and more.

Industry Foundation Classes (IFC) is a crucial data standard in the architecture, engineering, and construction (AEC) industry, serving to promote interoperability across varying software platforms. IFCDataContract aims to bridge the gap between the decentralized world of Ethereum and the AEC industry by allowing seamless access to IFC data.

The IFCDataContract contract acts as a client contract in a decentralized oracle network and is designed to request specific IFC data from an external data source, receive and store that data, and then provide access to the stored data.

The contract includes:

  • A function (requestIFCData) to request IFC data from the oracle. This function emits a ReceivedNewRequestId event that includes the unique request ID for tracking the request.
  • A function (fulfillIFCData) that is used by the oracle to fulfill the data request. This function updates the contract's state with the received data and emits an IFCDataUpdated event.
  • A function (getIFCData) to access the stored IFC data using the request ID.

The contract is derived from the Ownable contract, giving it a basic access control mechanism with an owner role. The owner can request IFC data, while the oracle is the only address authorized to fulfill data requests.

This contract represents a simple yet powerful example of how blockchain technology can interact with industry-specific standards like IFC, enabling the creation of decentralized applications that can serve specialized use cases in sectors such as construction and architecture.

Features

  • Oracle Integration: Request and retrieve IFC data via a decentralized oracle.
  • Access Control: Based on the Ownable pattern, ensures only authorized calls.
  • Event Logging: Enhanced traceability and frontend integration support.

Setup & Installation

  1. Prerequisites:

  2. Clone the repository:

    git clone <repository-link>
    cd IFCDataContract
  3. Install dependencies:

    npm install

Usage

  1. Compile the Contract:

    npx hardhat compile
  2. Deploy the Contract:

    npx hardhat run scripts/deploy.js --network rinkeby

    Replace rinkeby with your desired network.

Testing

  1. Run the Test Script:

    npx hardhat test

Class Diagram

classDiagram

  class IFCDataContract {
    -address public oracle
    -mapping(bytes32 => IFCData) private ifcData
    -event ReceivedNewRequestId(bytes32 indexed requestId)
    -event IFCDataUpdated(bytes32 indexed requestId, string buildingName, uint256 buildingHeight, uint256 buildingArea, uint256 buildingVolume)
    -modifier onlyOracle()
    +function requestIFCData() public onlyOwner
    +function fulfillIFCData(bytes32 _requestId, string memory _buildingName, uint256 _buildingHeight, uint256 _buildingArea, uint256 _buildingVolume) public onlyOracle
    +function getIFCData(bytes32 _requestId) public view returns (IFCData memory)
  }

  class Ownable {
    -address public owner
    -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
    -modifier onlyOwner()
    +function transferOwnership(address newOwner) public onlyOwner
  }

  class IFCData {
    string buildingName
    uint256 buildingHeight
    uint256 buildingArea
    uint256 buildingVolume
  }

  IFCDataContract --|> Ownable
Loading

In this diagram:

  • IFCDataContract is the main contract.
  • It is a subclass of Ownable, meaning it inherits from the Ownable contract.
  • IFCData is a struct used in the IFCDataContract contract.
  • The contract has a mapping called ifcData from bytes32 to IFCData.
  • Functions, modifiers, and events in the contract are also represented.

Colophon

Authors

This is an open-source project by the Block Foundation.

The Block Foundation mission is enabling architects to take back initiative and contribute in solving the mismatch in housing through blockchain technology. Therefore the Block Foundation seeks to unschackle the traditional constraints and construct middle ground between rent and the rigidity of traditional mortgages.

website: www.blockfoundation.io

Development Resources

Contributing

We'd love for you to contribute and to make this project even better than it is today! Please refer to the contribution guidelines for information.

Legal Information

Copyright

Copyright © 2023 Stichting Block Foundation. All Rights Reserved.

License

Except as otherwise noted, the content in this repository is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License, and code samples are licensed under the Apache 2.0 License.

Also see LICENSE and LICENSE-CODE.

Disclaimer

THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.