Skip to content
Testnet featureTestnet: yesMainnet: Not availableSoftware: Core bad4a06ea · protocol pqwerai-v8-testnet/1Updated

Payable functions

Native tPQAI behaves exactly like ether in the EVM: msg.value is in wei (1 tPQAI = 10^18 wei).

function tip(address to) external payable { … }          // accepts tPQAI with a call
receive() external payable { … }                          // plain transfers with empty calldata
  • A non-payable function reverts if msg.value > 0.
  • Pull, don't push. Credit balances and let recipients withdraw(); set state to zero before sending (TipJar.withdraw, ServiceEscrow.withdraw). A recipient that reverts then cannot block others.
  • Use call{value: amount}("") and check the result; transfer/send forward only 2300 gas.
  • The tested TipJar shows a payable function, a basis-point fee via a library and a pull withdrawal.
  • SELFDESTRUCT can force tPQAI into a contract without calling it; never rely on address(this).balance for accounting.

Sources at 83ff5b69f0 (project repository, not public yet): developers/examples/patterns/src/TipJar.sol · contracts/ai/ServiceEscrow.sol

Found a problem? Report a documentation issue · Build testnet-20778+83ff5b69f0