mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
751f62615d
This request implements an end to end Polygon state sync in the devnet. It does this by deploying smart contracts ont the L2 & L2 chain which follow the polygon fx portal model with security checks removed to simplify the code. The sync events generated are routed through a local mock heimdal - to avoid the consensus process for testing purposes. The commit also includes support code to help the delivery of additional contract based scenratios.
22 lines
597 B
Solidity
22 lines
597 B
Solidity
// SPDX-License-Identifier: LGPL-3.0
|
|
|
|
pragma solidity ^0.8.6;
|
|
|
|
interface IStateReceiver {
|
|
function onStateReceive(uint256 stateId, bytes calldata data) external;
|
|
}
|
|
|
|
contract ChildReceiver is IStateReceiver {
|
|
mapping(address => uint) public received;
|
|
|
|
constructor() {
|
|
}
|
|
|
|
function onStateReceive(uint, bytes calldata data) external override {
|
|
require(msg.sender == address(0x0000000000000000000000000000000000001001), "Invalid sender");
|
|
(address from, uint amount) = abi.decode(data, (address, uint));
|
|
uint total = received[from];
|
|
received[from] = total + amount;
|
|
}
|
|
}
|