TLDR; Yes, you can read the transaction log by sourcing the blockchain with tools like Demux or even trigger some actions on-chain by apply
-ing your smart contract on messages to eosio.token
.
I am quite not sure what you mean by making another "address", but for the second question, yes, it's possible.
1.If the subsequent actions after token transfer is executed on-block, you can set your contract to check for transactions to eosio.token
which is the contract we interact when we transfer EOS system token.
EOSIO's action can be thought as interaction between message and its handler. Think of it as registering your contract to list of handlers of messages to eosio.token
.
The way you achieve this by manipulating dispatcher, and in specific, the apply
function.
I'll leave a simple sample code to help you catch a grasp.
void apply(int64_t receiver, uint64_t code, uint64_t action) {
if( (code == receiver && name{action} != "transfer"_n) || (name{code} == "eosio.token"_n && name{action} == "transfer"_n)) {
switch( action ) {
// This transfer function is one implemented on your contract, not eosio.token, and will handle the actions you need.
EOSIO_DISPATCH_HELPER( foo, (transfer) )
}
}
}
DO NOT USE THIS CODE RIGHT AWAY! This code is simplified version without conditional statements to prevent malicious actions.
Playing around dispatcher is extremely dangerous so take your time on your own testnet before deploying it on the mainnet. This link might be helpful for you.
2.If the subsequent actions need to be done off-chain, consider using frameworks such as Demux
. Demux
is EOSIO official backend infrastructure built with javascript and is node-comaptible. When desired action happens, the action watcher you implemented will trigger action handlers which does the actual processing you need. Look at the examples code in github for more info.