Is it possible to deploy the Token contract (T) & CrowdSale contract (S) separately and still be possible to access (T)'s modifier protected methods from (S).
Code of (T)
contract Token {
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
Code of (S)
contract SellToken {
TokenInstance instance;
function SellToken(address _address) {
instance = TokenInstance(_address);
}
function () payable {
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
instance.mint(beneficiary, tokens);
}
}
For some reason, when i'm trying to send ether to (B) I get the following error
EDIT: I also tried the method of having an Abstract interface but that didn't seem to have much luck either (Ref: Stack exchange Post)
Abstract Interface
contract TokenAbstractInterface {
function mint(address _to, uint256 _amount) returns (bool);
function finishMinting() returns (bool);
}
Modified Code of (S)
contract SellToken {
TokenAbstractInterface instance;
function SellToken(address _address) {
instance = TokenAbstractInterface(_address);
}
function () payable {
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
instance.mint(beneficiary, tokens);
}
}