Skip to content

Commit

Permalink
docs: add book docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gnkz committed Aug 18, 2023
1 parent 0900adc commit bf61bf5
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/src/reference/modules/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ Sets the specified `slot` in the storage of the given `self` address to the prov

#### **`setNonce(address self, uint64 n) → (address)`**

Sets the nonce of the given `self` address to the provided value `n`.
Sets the nonce of the given `self` address to the provided value `n`. It will revert if the new
nonce is lower than the current address nonce.

#### **`setNonceUnsafe(address self, uint64 n) → (address)`**

Sets the nonce of the given `self` address to the provided arbitrary value `n`.

#### **`impersonateOnce(address self) → (address)`**

Expand Down
48 changes: 48 additions & 0 deletions docs/src/reference/modules/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ sets the `block.basefee` to `baseFee`

sets the `block.basefee` to `baseFee`

#### **`setBlockPrevrandao(Context self, bytes32 newPrevrandao) → (Context)`**

sets the `block.prevrandao` to `newPrevrandao`

#### **`setBlockPrevrandao(bytes32 newPrevrandao) → (Context)`**

sets the `block.prevrandao` to `newPrevrandao`

#### **`setChainId(Context self, uint64 chainId) → (Context)`**

sets the `block.chainid` to `chainId`
Expand All @@ -73,6 +81,14 @@ Sets the block coinbase to `who`.

Sets the block coinbase to `who`.

#### **`setGasPrice(Context self, address newGasPrice) → (Context)`**

Sets the gas price to `newGasPrice`.

#### **`setGasPrice(address newGasPrice) → (Context)`**

Sets the gas price to `newGasPrice`.

#### **`expectRevert(bytes revertData)`**

Function used to check whether the next call reverts or not.
Expand Down Expand Up @@ -113,6 +129,22 @@ Used to check if a call to `callee` with `data` was made.

Used to check if a call to `callee` with `data` and `msgValue` was made.

#### **`expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data)`**

Expect a call from `callee` with the specified `msgValue` and `data`, and a minimum amount of gas `minGas`.

#### **`expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count)`**

Expect a number of calls `count` from `callee` with the specified `msgValue` and `data`, and a minimum amount of gas `minGas`.

#### **`expectSafeMemory(uint64 min, uint64 max)`**

Allows to write on memory only between [0x00, 0x60) and [`min`, `max`) in the current subcontext

#### **`expectsafememorycall(uint64 min, uint64 max)`**

Allows to write on memory only between [0x00, 0x60) and [`min`, `max`) in the next subcontext

#### **`snapshot(Context) → (uint256)`**

Takes a snapshot of the current state of the vm and returns an identifier.
Expand All @@ -129,3 +161,19 @@ Reverts the state of the vm to the snapshot with id `snapshotId`.

Reverts the state of the vm to the snapshot with id `snapshotId`.

#### **`addBreakpoint(Context self, string memory name)`**

Creates a breakpoint to jump to in the debugger with `name`.

#### **`addBreakpoint(string memory name)`**

Creates a breakpoint to jump to in the debugger with `name`.

#### **`addConditionalBreakpoint(Context self, string memory name, bool condition)`**

Creates a conditional breakpoint to jump to in the debugger with name `name` and condition `condition`.

#### **`addConditionalBreakpoint(string memory name, bool condition)`**

Creates a conditional breakpoint to jump to in the debugger with name `name` and condition `condition`.

0 comments on commit bf61bf5

Please sign in to comment.