Skip to content

Add arbitrary data to each broadcast #3298

@adhusson

Description

@adhusson

Component

Forge

Describe the feature you would like

It would be useful for processes that manage broadcast log files if each tx could have arbitrary data attached. My use case is giving names to deployed contracts.

The interface could look like this:

function broadcast(bytes calldata) external;
function broadcast(address, bytes calldata) external;
function broadcast(uint256, bytes calldata) external;

and be used like this:

vm.broadcast(bytes("BetterContract"));
new Contract();

// struct TxInfo({uint version; string message;})
vm.broadcast(abi.encode(TxInfo({version: 2, message: "updating the oracle"})));
oracle.update();

The resulting JSON would look like this:

{
  "transactions": [
    {
      "hash": "0x16cd3c8ce4f1f3d03582e1d1132c90297469b36e5ee74fc9957cdceb4e3f51f6",
      "transactionType": "CREATE",
      "memo": <arbitrary bytes>
     }
   ]
 }

Or, to be easier to read in the JSON by default, just allow a string:

function broadcast(string calldata) external;
function broadcast(address, string calldata) external;
function broadcast(uint256, string calldata) external;

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions