The Foreign Call Protocol (FCP) facilitates the ability for SmartWeave contracts to behave inter-operably by invoking functions from other contracts that support FCP.
The lack of interoperability between Arweave-based smart contracts has widely been considered a limiting factor to what developers can build with SmartWeave. It forced smart contract developers to design mechanisms that could not utilize or interface with external, existing mechanisms. The FCP removes this restriction.
invoke
function.readOutbox
functionThe FCP allows for two-way communication between SmartWeave contracts on Arweave. In order to facilitate this, contracts need two new arrays in their states and two new functions in their sources:
State modifications
invocations: string[]
foreignCalls: { txID: string, contract: string, input:*contract interaction object* }[]
Contract source modifications
invoke(foreignContract: string, invocation:*contract interaction object*)
readOutbox(contract: string, id: integer)
See two example contracts that successfully utilized the Foreign Call Protocol: ABC and DEF.