I try to search on ERC 223 receiving contract implementation online but most of them just providing the interface. I am wondering if it is possible to do something like this for ERC 223 receiving contract.
Eg: I send token from transfer function in the main token contract. And based on the value (probably sig of functions in the receiving contract and values), the functions in receiving contract is call from tokenFallback and if the functions fail halfway all transaction reverted.
contract ERC223Receiver {
function tokenReceiveLogic1() internal {
require(tokenReceiveAmount > 3);
// logic here
}
function tokenReceiveLogic2() internal {
require(tokenReceiveAmount > 1);
// logic here
}
function tokenFallback(
address _sender,
uint256 _value,
bytes _extraData) returns (bool) {
if (condition 1) {
// trigger tokenReceiveLogic1()
// if tokenReceiveLogic1 fail halfway, revert all transaction
} else if (condition 2) {
// trigger tokenReceiveLogic1()
// if tokenReceiveLogic1 fail halfway, revert all transaction
}
}
}