Skip to main content
Removed title case, removed unnecessary text and thanks as per SE policy, added code formatting and fixed typos,
Source Link

Trying To Get Child Function To Workto get child function to work - Remix Won't Compile Parentwon't compile parent

Novice coder here so hopefully somebody has the patience to answer my (probably incomplete) question, apologies in advance if not enough info.

I am trying to create a scenario whereby a user can create a child token from the main contract (and then later on a (grand[?])child coin from that token).

I have looked up various documentation and Q&As and have cobbled together the code below. My problem is Remix will not compile the parent contract, saying that child.solChild.sol cannot be found, even though it is 2two steps away from the parent. I'm fairly sure the problem is within the Child.solChild.sol contract as I've just C+P'dcopied and pasted the info, any help is greatly appreciated.

Thank youinformation.

Trying To Get Child Function To Work - Remix Won't Compile Parent

Novice coder here so hopefully somebody has the patience to answer my (probably incomplete) question, apologies in advance if not enough info.

I am trying to create a scenario whereby a user can create a child token from the main contract (and then later on a (grand[?])child coin from that token).

I have looked up various documentation and Q&As and have cobbled together the code below. My problem is Remix will not compile the parent contract, saying that child.sol cannot be found, even though it is 2 steps away from the parent. I'm fairly sure the problem is within the Child.sol contract as I've just C+P'd the info, any help is greatly appreciated.

Thank you.

Trying to get child function to work - Remix won't compile parent

I am trying to create a scenario whereby a user can create a child token from the main contract (and then later on a (grand[?])child coin from that token).

I have looked up various documentation and Q&As and have cobbled together the code below. My problem is Remix will not compile the parent contract, saying that Child.sol cannot be found, even though it is two steps away from the parent. I'm fairly sure the problem is within the Child.sol contract as I've just copied and pasted the information.

Source Link

Trying To Get Child Function To Work - Remix Won't Compile Parent

Novice coder here so hopefully somebody has the patience to answer my (probably incomplete) question, apologies in advance if not enough info.

I am trying to create a scenario whereby a user can create a child token from the main contract (and then later on a (grand[?])child coin from that token).

I have looked up various documentation and Q&As and have cobbled together the code below. My problem is Remix will not compile the parent contract, saying that child.sol cannot be found, even though it is 2 steps away from the parent. I'm fairly sure the problem is within the Child.sol contract as I've just C+P'd the info, any help is greatly appreciated.

Thank you.

pragma solidity ^0.4.21;

import "./EIP20Interface.sol";
import "../Child.sol";


contract MyTestToken is EIP20Interface {

uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;

string public name;                   
uint8 public decimals;              
string public symbol;

function MyTestToken(
    uint256 _initialAmount,
    string _tokenName,
    uint8 _decimalUnits,
    string _tokenSymbol
) public {
    balances[msg.sender] = _initialAmount;               
    totalSupply = _initialAmount;                        
    name = _tokenName;                                  
    decimals = _decimalUnits;                            
    symbol = _tokenSymbol;                               
}

function transfer(address _to, uint256 _value) public returns (bool success) {
    require(balances[msg.sender] >= _value);
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    emit Transfer(msg.sender, _to, _value); 
    return true;
}

function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    uint256 allowance = allowed[_from][msg.sender];
    require(balances[_from] >= _value && allowance >= _value);
    balances[_to] += _value;
    balances[_from] -= _value;
    if (allowance < MAX_UINT256) {
        allowed[_from][msg.sender] -= _value;
    }
    emit Transfer(_from, _to, _value); 
    return true;
}

function balanceOf(address _owner) public view returns (uint256 balance) {
    return balances[_owner];
}

function approve(address _spender, uint256 _value) public returns (bool success) {
    allowed[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
}

function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
    return allowed[_owner][_spender];
}

mapping(bytes32 => Child) childList;

function spawnChild(bytes32 childId) {
Child current = new Child();
childList[childId] = current;
}

function callChildFunction(bytes32 childId) {
childList[childId].theChildfunction();
 } 

}


pragma solidity ^0.4.21;

contract DataItem {
bytes32 key;
string value;

function DataItem(bytes32 k, string v) {
    key = k;
    value = v;
 }
}
contract DAppInterface {
mapping(bytes32 => address) public dataItems;

function addDataItem(bytes32 k, string v) external {
    dataItems[k] = new DataItem(k, v);
 }
}