Skip to content

Commit 84ab71a

Browse files
mablrzerosnacksampagent
authored
docs: add NatSpec @notice to public functions (#860)
Towards #653 Adds `@notice` tags to all public-facing and internal functions enabling forge doc to autogenerate reference documentation for the Foundry Book. No function signatures or behavior changed. --------- Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>
1 parent 8b531a0 commit 84ab71a

6 files changed

Lines changed: 311 additions & 47 deletions

File tree

src/StdChains.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ abstract contract StdChains {
6565

6666
bool private fallbackToDefaultRpcUrls = true;
6767

68-
// The RPC URL will be fetched from config or defaultRpcUrls if possible.
68+
/// @notice Returns chain data for the given alias, with the RPC URL resolved from config or defaults.
69+
/// @dev Reverts if `chainAlias` is empty or has not been registered.
6970
function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) {
7071
require(bytes(chainAlias).length != 0, "StdChains getChain(string): Chain alias cannot be the empty string.");
7172

@@ -79,6 +80,8 @@ abstract contract StdChains {
7980
chain = getChainWithUpdatedRpcUrl(chainAlias, chain);
8081
}
8182

83+
/// @notice Returns chain data for the given chain ID, with the RPC URL resolved from config or defaults.
84+
/// @dev Reverts if `chainId` is `0` or has not been registered.
8285
function getChain(uint256 chainId) internal virtual returns (Chain memory chain) {
8386
require(chainId != 0, "StdChains getChain(uint256): Chain ID cannot be 0.");
8487
initializeStdChains();
@@ -94,7 +97,7 @@ abstract contract StdChains {
9497
chain = getChainWithUpdatedRpcUrl(chainAlias, chain);
9598
}
9699

97-
// set chain info, with priority to argument's rpcUrl field.
100+
/// @notice Registers chain data under `chainAlias`, with priority given to the argument's `rpcUrl` field.
98101
function setChain(string memory chainAlias, ChainData memory chain) internal virtual {
99102
require(
100103
bytes(chainAlias).length != 0,
@@ -127,7 +130,7 @@ abstract contract StdChains {
127130
idToAlias[chain.chainId] = chainAlias;
128131
}
129132

130-
// set chain info, with priority to argument's rpcUrl field.
133+
/// @notice Registers chain data under `chainAlias`, with priority given to the argument's `rpcUrl` field.
131134
function setChain(string memory chainAlias, Chain memory chain) internal virtual {
132135
setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl}));
133136
}
@@ -184,6 +187,7 @@ abstract contract StdChains {
184187
return chain;
185188
}
186189

190+
/// @notice Sets whether to fall back to default RPC URLs when no URL is configured for a chain.
187191
function setFallbackToDefaultRpcUrls(bool useDefault) internal {
188192
fallbackToDefaultRpcUrls = useDefault;
189193
}

0 commit comments

Comments
 (0)