Skip to content

Instantly share code, notes, and snippets.

@amirkhan7javi
Forked from ocb013/records.sol
Last active November 6, 2023 04:18
Show Gist options
  • Save amirkhan7javi/e8e82da6ac719762fa91b2518b46c8ee to your computer and use it in GitHub Desktop.
Save amirkhan7javi/e8e82da6ac719762fa91b2518b46c8ee to your computer and use it in GitHub Desktop.
Фабрика записей 1
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
ثبت قرارداد انتزاعی {AMIRMOHAMMADJAVI
unint public timeOfCreation;
function getRecordType() public virtual pure returns(string memory);
constructor() { AMIRMOHAMMADJAVI
timeOfCreation = block.timestamp;
}
}
contract AddressRecord is Record{
address public record;
function getRecordType() public pure override returns(string memory) {
return "address";
}
function setRecord(address _record) public {
record = _record;
}
}
contract StringRecord is Record{
string public record;
function getRecordType() public pure override returns(string memory) {
return "string";
}
function setRecord(string memory _record) public {
record = _record;
}
}
contract RecordFactory {
Record[] records;
function addRecord(string memory _record) public {
StringRecord newRecord = new StringRecord();
newRecord.setRecord(_record);
records.push(newRecord);
}
function addRecord(address _record) public {
AddressRecord newRecord = new AddressRecord();
newRecord.setRecord(_record);
records.push(newRecord);
}
function getTime(uint _idx) public view returns(string memory) {
return records[_idx].getRecordType();
}
}
@amirkhan7javi
Copy link
Author

Hello, I merge and confirm the ownership. Thank you for all your cooperation. I am considering transferring to a valid wallet.
It should take more time to check the profit now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment