mirror of
https://github.com/hanzoai/viem.git
synced 2026-10-30 19:36:39 +00:00
Adds the simulate action (eth_call against nonpayable/payable functions), returning the decoded result plus a write-compatible request. Includes runtime + type tests, simulate/write docs pages and sidebar wiring, and write.test.ts coverage for broadcasting a simulate request (overloaded and chain-mismatch variants).
21 lines
632 B
Solidity
21 lines
632 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.23;
|
|
|
|
/// @dev Deterministic, self-hosted contract exercising write-specific calldata
|
|
/// encoding: a `payable` function (so the `value` field can be threaded and
|
|
/// asserted on-chain) and an overloaded function (so overload selection by
|
|
/// `args` can be verified). Used by the `contract.write` tests.
|
|
contract WriteExample {
|
|
function pay() external payable {}
|
|
|
|
function foo() external {}
|
|
|
|
function foo(uint256 x) external returns (uint256) {
|
|
return x;
|
|
}
|
|
|
|
function foo(uint256 x, uint256 y) external returns (uint256) {
|
|
return x + y;
|
|
}
|
|
}
|