Skip to content

Instantly share code, notes, and snippets.

@masihtehrani
Created July 30, 2025 12:21
Show Gist options
  • Select an option

  • Save masihtehrani/db109ea3fe922d48837ba66d7a0bf9a7 to your computer and use it in GitHub Desktop.

Select an option

Save masihtehrani/db109ea3fe922d48837ba66d7a0bf9a7 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.30+commit.73712a01.js&optimize=false&runs=200&gist=
// File: RwaTokenFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// Import the struct definition from the other file
import "./RwaToken.sol";
contract RwaTokenFactory is Ownable {
IBeacon public immutable beacon;
event TokenCreated(
string name,
string symbol,
address proxyAddress,
address creator
);
constructor(address _beaconAddress) Ownable(msg.sender) {
beacon = IBeacon(_beaconAddress);
}
function createRwaToken(
RwaTokenParams calldata params
) external onlyOwner returns (address) {
bytes memory data = abi.encodeWithSelector(
RwaToken.initialize.selector,
params
);
BeaconProxy proxy = new BeaconProxy(address(beacon), data);
emit TokenCreated(params.name, params.symbol, address(proxy), msg.sender);
return address(proxy);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment