Skip to content

Instantly share code, notes, and snippets.

@fdemiramon
Last active January 5, 2022 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdemiramon/86a345b179aa1f95d1d6d6c7ea8f1e41 to your computer and use it in GitHub Desktop.
Save fdemiramon/86a345b179aa1f95d1d6d6c7ea8f1e41 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.1+commit.df193b15.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
interface IConcatNameFactory {
function createConcatName(address concatNameAddress) external returns(address);
}
contract ConcatName {
bytes public name;
IConcatNameFactory public factory;
constructor(bytes memory _name) {
name = _name;
factory = IConcatNameFactory(msg.sender);
}
function deposit() external payable returns(address){
return factory.createConcatName(address(this));
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./ConcatName.sol";
contract ConcatNameFactory {
function createConcatName(address ConcatNameAddress) external returns(address) {
return address(new ConcatName(abi.encodePacked(ConcatName(ConcatNameAddress).name(), abi.encodePacked("+"))));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment