From 0bde292f7928c714f05c2beaad07bb377de05133 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 20 Oct 2024 11:37:05 +0700 Subject: [PATCH] Create RollupValidator.sol --- .../contracts/rollups/RollupValidator.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupValidator.sol diff --git a/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupValidator.sol b/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupValidator.sol new file mode 100644 index 000000000..42ea79195 --- /dev/null +++ b/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupValidator.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./Rollup.sol"; + +contract RollupValidator { + Rollup public rollup; + + event TransactionValidated(bytes32 indexed stateRoot, address indexed sender); + + constructor(address _rollup) { + rollup = Rollup(_rollup); + } + + function validateTransaction(bytes32 _stateRoot, address _sender) external { + require(rollup.getCurrentStateRoot() == _stateRoot, "Invalid state root"); + emit TransactionValidated(_stateRoot, _sender); + } +}