Skip to content

Commit

Permalink
add contract methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-bousfield committed Jun 20, 2023
1 parent 878586b commit edb6279
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/precompiles/ArbOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,19 @@ interface ArbOwner {
function setWasmMaxDepth(uint32 depth) external;

// @notice sets the cost of starting a stylus hostio call
function setWasmHostioInk(uint64 cost) external;
function setWasmHostioInk(uint64 ink) external;

// @notice sets the number of free wasm pages a tx gets
function setWasmFreePages(uint16 pages) external;

// @notice sets the base cost of each additional wasm page
function setWasmPageGas(uint32 gas) external;

// @notice sets the ramp that drives exponential wasm memory costs
function setWasmPageRamp(uint64 ramp) external;

// @notice sets the maximum number of pages a wasm may allocate
function setWasmPageLimit(uint16 limit) external view;

/// @notice Sets serialized chain config in ArbOS state
function setChainConfig(string calldata chainConfig) external;
Expand Down
26 changes: 21 additions & 5 deletions src/precompiles/ArbWasm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ interface ArbWasm {
// @return version the stylus version
function stylusVersion() external view returns (uint32 version);

// @notice gets the stylus version the program was most recently compiled against.
// @return version the program version (0 for EVM contracts)
function programVersion(address program) external view returns (uint32 version);

// @notice gets the conversion rate between gas and ink
// @return price the price (in evm gas basis points) of ink
function inkPrice() external view returns (uint64 price);
Expand All @@ -27,12 +31,24 @@ interface ArbWasm {
function wasmMaxDepth() external view returns (uint32 depth);

// @notice gets the fixed-cost overhead needed to initiate a hostio call
// @return cost the cost (in ink) of starting a stylus hostio call
function wasmHostioInk() external view returns (uint64 price);
// @return ink the cost of starting a stylus hostio call
function wasmHostioInk() external view returns (uint64 ink);

// @notice gets the stylus version the program was most recently compiled against.
// @return version the program version (0 for EVM contracts)
function programVersion(address program) external view returns (uint32 version);
// @notice gets the number of free wasm pages a program gets
// @return pages the number of wasm pages (2^16 bytes)
function freePages() external view returns (uint16 pages);

// @notice gets the base cost of each additional wasm page (2^16 bytes)
// @return gas base amount of gas needed to grow another wasm page
function pageGas() external view returns (uint32 gas);

// @notice gets the ramp that drives exponential memory costs
// @return ramp bits representing the floating point value
function pageRamp() external view returns (uint64 ramp);

// @notice gets the maximum number of pages a wasm may allocate
// @return limit the number of pages
function pageLimit() external view returns (uint16 limit);

error ProgramNotCompiled();
error ProgramOutOfDate(uint32 version);
Expand Down

0 comments on commit edb6279

Please sign in to comment.