pragma solidity ^0.5.9; contract LC { TokenCreator creator; address owner; //use "address payable" if we need to send ETH to it... uint grai; uint length; uint width; uint height; uint weight; string[2][] links; constructor(uint _grai, uint _length, uint _width, uint _height, uint _weight) public { creator = TokenCreator(msg.sender); owner = msg.sender; grai = _grai; length = _length; width = _width; height = _height; weight = _weight; } function add_link(string memory link, string memory hash) public { links.push([link,hash]); } function show_links(uint index) public { //log3( //bytes32(links))(links[index]); } function show_params() public { log4( bytes32(uint(grai)), bytes32(uint(length)), bytes32(uint(width)), bytes32(uint(height)), bytes32(uint(weight)) ); } /*function show_links() public { log0( bytes32(links) ); }*/ function change_id(uint newgrai) public { if (msg.sender == address(creator)) grai = newgrai; } function transfer(address newOwner) public { if (msg.sender != owner) return; if (creator.isTokenTransferOK(owner, newOwner)) owner = newOwner; } } contract TokenCreator { function createToken(uint grai, uint length, uint width, uint height, uint weight) public returns (LC tokenAddress) { return new LC(grai, length, width, height, weight); } //function change_grai(OwnedToken tokenAddress, uint grai) public { // tokenAddress.change_grai(grai); //} function isTokenTransferOK(address currentOwner, address newOwner) public pure returns (bool ok) { // Check an arbitrary condition to see if transfer should proceed return keccak256(abi.encodePacked(currentOwner, newOwner))[0] == 0x7f; } }