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.
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 aReceivedNewRequestId
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 anIFCDataUpdated
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.
- 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.
-
Prerequisites:
-
Clone the repository:
git clone <repository-link> cd IFCDataContract
-
Install dependencies:
npm install
-
Compile the Contract:
npx hardhat compile
-
Deploy the Contract:
npx hardhat run scripts/deploy.js --network rinkeby
Replace
rinkeby
with your desired network.
-
Run the Test Script:
npx hardhat test
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
In this diagram:
IFCDataContract
is the main contract.- It is a subclass of
Ownable
, meaning it inherits from theOwnable
contract. IFCData
is a struct used in theIFCDataContract
contract.- The contract has a mapping called
ifcData
frombytes32
toIFCData
. - Functions, modifiers, and events in the contract are also represented.
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
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.
Copyright © 2023 Stichting Block Foundation. All Rights Reserved.
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.
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.