function fundsToStream(uint256 streamId, uint256 amount)
public
returns (bool result)
{
require(amount > 0, "amount is zero");
/* Approve the XHalflife contract to spend. */
_xdex.approve(address(halflife), amount);
/* Transfer the tokens to this contract. */
_xdex.transferFrom(msg.sender, address(this), amount);
result = halflife.fundStream(streamId, amount);
emit Fund(msg.sender, streamId, amount);
}
建议:
function fundsToStream(uint256 streamId, uint256 amount1, uint256 amount2)
public
returns (bool result)
{
require(amount > 0, "amount is zero");
/* Approve the XHalflife contract to spend. */
_xdex.approve(address(halflife), amount1.add(amount2));
/* Transfer the tokens to this contract. */
_xdex.transferFrom(msg.sender, address(this), amount1.add(amount2));
result = halflife.fundStream(streamId, amount1, amount2);
emit Fund(msg.sender, streamId, amount1, amount2);
}
现在:
function fundsToStream(uint256 streamId, uint256 amount) public returns (bool result) { require(amount > 0, "amount is zero");
建议:
并且建议:
因此Fund日志也要分开amount1,amount2来分开打。approve和transfer可以一起做