Skip to content

Commit 8f75d43

Browse files
committed
replace calldata with memory in libs
1 parent a0c376c commit 8f75d43

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

packages/common/src/codegen/render-solidity/common.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ImportDatum, StaticResourceData, RenderKeyTuple, RenderType } from "./t
22
import { resourceToHex } from "../../resourceToHex";
33
import { hexToResource } from "../../hexToResource";
44
import { renderImportPath } from "./renderImportPath";
5+
import { isDefined } from "../../utils";
56

67
/**
78
* Common header for all codegenerated solidity files
@@ -22,8 +23,11 @@ export function renderList<T>(list: T[], renderItem: (item: T, index: number) =>
2223
* Renders a comma-separated list of arguments for solidity functions, ignoring empty and undefined ones
2324
*/
2425
export function renderArguments(args: (string | undefined)[]): string {
25-
const filteredArgs = args.filter((arg) => arg !== undefined && arg !== "") as string[];
26-
return internalRenderList(",", filteredArgs, (arg) => arg);
26+
return args
27+
.filter(isDefined)
28+
.filter((arg) => arg !== "")
29+
.map((arg) => arg.replace(/ calldata /, " memory "))
30+
.join(", ");
2731
}
2832

2933
interface RenderedCommonData {

packages/store/src/IStoreRegistration.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ interface IStoreRegistration {
1717
FieldLayout fieldLayout,
1818
Schema keySchema,
1919
Schema valueSchema,
20-
string[] memory keyNames,
21-
string[] memory fieldNames
20+
string[] calldata keyNames,
21+
string[] calldata fieldNames
2222
) external;
2323

2424
// Register hook to be called when a record or field is set or deleted

packages/store/test/StoreMock.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ contract StoreMock is Store {
127127
FieldLayout fieldLayout,
128128
Schema keySchema,
129129
Schema valueSchema,
130-
string[] memory keyNames,
131-
string[] memory fieldNames
130+
string[] calldata keyNames,
131+
string[] calldata fieldNames
132132
) public virtual {
133133
StoreCore.registerTable(tableId, fieldLayout, keySchema, valueSchema, keyNames, fieldNames);
134134
}

packages/world/src/codegen/experimental/systems/BatchCallSystemLib.sol

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/world/src/codegen/interfaces/IBatchCallSystem.sol

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)