My function keeps returning a transaction hash but it is supposed to return a uint. I call it as a function in the console sale.priceOfEther(). im using solidity 0.5.0 and ganache.
function priceOfEther() public view returns (uint256){
uint256 maxTokenPrice = WEI_DECIMALS.div(100).mul(7); //max price $0.07 USD per token multiplied by wei early to avoid truncation by division.
uint256 minTokenPrice = WEI_DECIMALS.div(1000).mul(7); //min price $0.007 USD per token multiplied by wei early to avoid truncation by division.
uint256 minWeiPerToken = minTokenPrice.div(ethUSD);
uint256 maxWeiPerToken = maxTokenPrice.div(ethUSD);
uint256 increments = (maxWeiPerToken.sub(minWeiPerToken)).div(AVG_NUM_INVESTORS);
price = minWeiPerToken.add(increments.mul(count));
if (price > maxWeiPerToken) {
price = maxWeiPerToken;
}
assert(price != 0);
return price;
}
this is what is returned in the truffle console
{ tx: '0x8c3c2b4979117f380a7f6d39fd6f46e3566436ada25b5048ecaaef40743f5586',
receipt:
{ transactionHash: '0x8c3c2b4979117f380a7f6d39fd6f46e3566436ada25b5048ecaaef40743f5586',
transactionIndex: 0,
blockHash: '0xc3410bdede3bb7afe8889065dc8089a48d7e1285c63e7c43a205bd33d7cc0884',
blockNumber: 11,
from: '0x3f32e6ca9e7f433d0f5dea6b1024d3b0768e2dbf',
to: '0x6bab62d945dfe3c862caf9a3b59c6c435f3de1d4',
gasUsed: 50007,
cumulativeGasUsed: 50007,
contractAddress: null,
logs: [],
status: true,
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
rawLogs: [] },
logs: [] }