Skip to content

Commit

Permalink
Updated docs to use external links.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 2, 2020
1 parent acd601e commit 8eb0190
Show file tree
Hide file tree
Showing 20 changed files with 320 additions and 67 deletions.
194 changes: 194 additions & 0 deletions docs.wrm/api/other/assembly.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
_title: Assembly

_section: Assembly @<asm>

_subsection: Opcode @<asm-opcode>

_property: asm.Opcode.from(valueOrMnemonic) => [[asm-opcode]]
Create a new instnace of an Opcode for a given numeric value
(e.g. 0x60 is PUSH1) or mnemonic (e.g. "PUSH1").

_property: opcode.value => number
The value (bytecode as a number) of this opcode.

_property: opcode.mnemonic => string
The mnemonic string of this opcode.

_property: opcode.delta => number
The number of items this opcode will consume from the stack.

_property: opcode.alpha => number
The number of items this opcode will push onto the stack.

_property: opcode.doc => string
A short description of what this opcode does.

_property: opcode.isMemory() => boolean
Returns true if the opcode accesses memory.

_property: opcode.isStatic() => boolean
Returns true if the opcode cannot change state.

_property: opcode.isJump() => boolean
Returns true if the opcode is a jumper operation.

_property: opcode.isPush() => number
Returns 0 if the opcode is not a ``PUSH*``, or the number
of bytes this opcode will push if it is.

_subsection: Assembler

_heading: Operation @<asm-operation>

An **Operation** is a single command from a disassembled bytecode
stream.

_property: operation.opcode => [[asm-opcode]]
_property: operation.offset => number
_property: operation.pushValue => string

_heading: Functions

_property: asm.parse(code) => [[asm-node]] @SRC<asm/assembler>
Parse an ethers-format assembly file and return the [[asm-ast]].

_property: asm.assemble(node) => string<[[datahexstring]]> @SRC<asm/assembler:function.assemble>
Performs assembly of the [[asm-ast]] //node// and return the
resulting bytecode representation.

_property: asm.disassemble(bytecode) => Array<[[asm-operation]]> @SRC<asm/assembler>
Returns an array of Operations given //bytecode//.

In addition to a standard array, the return also has a
``getOperation(offset)`` method, which can be used to get
the operation at a given byte offset, which prevents access
to internal ``PUSH`` bytes (i.e. safe JUMPDEST).

_property: asm.formatBytecode(operations) => string @SRC<asm/assembler>
Create a formatted output of an array of [[asm-operation]].

_subsection: Abstract Syntax Tree @<asm-ast>

Parsing an file using the [Ethers ASM Grammar](link-ethers-asm-grammar)
will generate an Abstract Syntax Tree. The root node will always
be a [[asm-scopenode]] whose name is ``_``.

_heading: Location @<asm-location>

_property: offset => number
The offset into the source code to the start of this node.

_property: length => number
The length of characters in the source code to the end of this node.

_property: source => string
The source code of this node.


_heading: Node @<asm-node> @SRC<asm:class.Node>

_property: node.tag => string
A unique tag for this node for the lifetime of the process.

_property: node.location => [[asm-location]]
The source code and location within the source code that this
node represents.


_heading: ValueNode @<asm-valuenode> @INHERIT<[[asm-node]]> @SRC<asm:class.ValueNode>

A **ValueNode** is a node which may manipulate the stack.


_heading: LiteralNode @<asm-literalnode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.LiteralNode>

_property: literalNode.value => string
The literal value of this node, which may be a [[datahexstring]] or
string of a decimal number.

_property: literalNode.verbatim => boolean
This is true in a [[asm-datanode]] context, since in that case the
value should be taken verbatim and no ``PUSH`` operation shoud be
added, otherwise false.


_heading: LinkNode @<asm-linknode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.LinkNode>

A **LinkNode** represents a link to another [[asm-node]]'s data,
for example ``$foo`` or ``#bar``.

_property: linkNode.label => string
Te name of the target node.

_property: linkNode.type => "offset" | "length"
Whether this node is for an offset or a length value of the
target node.


_heading: OpcodeNode @<asm-opcodenode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.OpcodeNode>

_property: opcodeNode.opcode => [[asm-opcode]]
The opcode for this Node.

_property: opcodeNode.operands => Array<[[asm-valuenode]]>
A list of all operands passed into this Node.


_heading: EvaluationNode @<asm-evaluationnode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.EvaluationNode>

An **EvaluationNode** is used to execute code and insert the results
but does not generate
any output assembly, using the ``{{! code here }}`` syntax.

_property: literalNode.verbatim => boolean
This is true in a [[asm-datanode]] context, since in that case the
value should be taken verbatim and no ``PUSH`` operation shoud be
added, otherwise false.

_property: evaluationNode.script => string
The code to evaluate and produce the result to use as a literal.


_heading: ExecutionNode @<asm-executionnode> @INHERIT<[[asm-node]]> @SRC<asm:class.ExecutionNode>

An **ExecutionNode** is used to execute code but does not generate
any output assembly, using the ``{{! code here }}`` syntax.

_property: evaluationNode.script => string
The code to execute. Any result is ignored.


_heading: LabelledNode @<asm-labellednode> @INHERIT<[[asm-node]]> @SRC<asm:class.LabelledNode>

A **LabelledNode** is used for any Node that has a name, and can therefore
be targetted by a [[asm-linknode]].

_property: labelledNode.name => string
The name of this node.


_heading: LabelNode @<asm-labelnode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.LabelNode>

A **LabelNode** is used as a place to ``JUMP`` to by referencing it
name, using ``@myLabel:``. A ``JUMPDEST`` is automatically inserted
at the bytecode offset.


_heading: DataNode @<asm-datanode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.DataNode>

A **DataNode** allows for data to be inserted directly into the output
assembly, using ``@myData[ ... ]``. The data is padded if needed to ensure
values that would otherwise be regarded as a ``PUSH`` value does not impact
anything past the data.

_property: dataNode.data => Array<[[asm-valuenode]]>
The child nodes, which each represent a verbatim piece of data in insert.

_heading: ScopeNode @<asm-scopenode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.ScopeNode>


A **ScopeNode** allows a new frame of reference that all [[asm-linknode]]'s
will use when resolving offset locations, using ``@myScope{ ... }``.

_property: scopeNode.statements => Array<[[asm-node]]>
The list of child nodes for this scope.
2 changes: 1 addition & 1 deletion docs.wrm/api/other/hardware/index.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _section: Hardware Wallets

_subsection: LedgerSigner @<hw-ledger> @INHERIT<[[signer]]> @SRC<hardware-wallets:class.LedgerSigner>

The [Ledger Hardware Wallets](https://www.ledger.com) are a fairly
The [Ledger Hardware Wallets](link-ledger) are a fairly
popular brand.

TODO: importing
Expand Down
1 change: 1 addition & 0 deletions docs.wrm/api/other/index.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ ancillary packages, which are not part of the core but optionally
add functionality only needed in certain situations.

_toc:
assembly
hardware
9 changes: 4 additions & 5 deletions docs.wrm/api/providers/api-providers.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To mitigate these issues, it is recommended you use a
_subsection: EtherscanProvider @INHERIT<[[provider]]>

The **EtherscanProvider** is backed by a combination of the various
[Etherscan APIs](https://etherscan.io/apis).
[Etherscan APIs](link-etherscan-api).

_property: provider.getHistory(address) => Array<History>

Expand All @@ -33,7 +33,7 @@ _definition: **Supported Networks**

_subsection: InfuraProvider @INHERIT<[[provider-urljsonrpc]]>

The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
The **InfuraProvider** is backed by the popular [INFURA](link-infura)
Ethereum service.

_definition: **Supported Networks**
Expand All @@ -47,7 +47,7 @@ _definition: **Supported Networks**

_subsection: AlchemyProvider @INHERIT<[[provider-urljsonrpc]]>

The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
The **AlchemtProvider** is backed by [Alchemy](link-alchemy).

_definition: **Supported Networks**

Expand All @@ -60,8 +60,7 @@ _definition: **Supported Networks**

_subsection: CloudfrontProvider @INHERIT<[[provider-urljsonrpc]]>

The CloudfrontProvider is backed by the
[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/).
The CloudfrontProvider is backed by the [Cloudflare Ethereum Gateway](link-cloudflare).

_definition: **Supported Networks**

Expand Down
8 changes: 4 additions & 4 deletions docs.wrm/api/providers/jsonrpc-provider.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ _title: JSON-RPC Provider

_section: JsonRpcProvider @<provider-jsonrpc> @INHERIT<[[provider]]>

The [JSON-RPC API](https:/\/github.com/ethereum/wiki/wiki/JSON-RPC) is a
The [JSON-RPC API](link-jsonrpc) is a
very popular method for interacting with Ethereum and is available in all
major Ethereum node implementations (e.g. [Geth](https:/\/geth.ethereum.org)
and [Parity](https:/\/www.parity.io)) as well as many third-party web
services (e.g. [INFURA](https://infura.io))
major Ethereum node implementations (e.g. [Geth](link-geth)
and [Parity](link-parity)) as well as many third-party web
services (e.g. [INFURA](link-infura))

_property: new ethers.providers.JsonRpcProvider([ url [ , aNetworkish ] ])
Connect to a JSON-RPC API located at //url// using the /aNetworkish// network.
Expand Down
10 changes: 4 additions & 6 deletions docs.wrm/api/providers/other.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ The URL to use for the JsonRpcProvider instance.

_subsection: Web3Provider @<provider-web3> @INHERIT<[[provider-jsonrpc]]>

The Web3Provider is meant to ease moving from a [web3.js based](https://github.com/ethereum/web3.js)
The Web3Provider is meant to ease moving from a [web3.js based](link-web3)
application to ethers by wraping an existing Web3-compatible (such as a
[Web3HttpProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http)
[Web3IpcProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc) or
[Web3WsProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws))
and exposing it as an ethers.js [[provider]] which can then be used with the rest of
the library.
[Web3HttpProvider](link-web3-http)[Web3IpcProvider](link-web3-ipc) or
[Web3WsProvider](link-web3-ws)) and exposing it as an ethers.js [[provider]]
which can then be used with the rest of the library.

_property: new ethers.providers.Web3Provider(web3Provider [, network ])
Create a new **Web3Provider**, which wraps an [EIP-1193 Provider]() or
Expand Down
10 changes: 5 additions & 5 deletions docs.wrm/api/providers/types.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ The amount (in wei) this transaction is sending.

_property: transactionRequest.chainId => number | Promise<number>
The chain ID this transaction is authorized on, as specified by
[EIP-155](https:/\/eips.ethereum.org/EIPS/eip-155).
[EIP-155](link-eip-155).

If the chain ID is 0 will disable EIP-155 and the transaction will be valid
on any network. This can be **dangerous** and care should be taken, since it
Expand Down Expand Up @@ -253,7 +253,7 @@ the block this transaction was mined in.
_property: receipt.root => string
The intermediate state root of a receipt.

Only transactions included in blocks **before** the [Byzantium Hard Fork](https:/\/eips.ethereum.org/EIPS/eip-609)
Only transactions included in blocks **before** the [Byzantium Hard Fork](link-eip-609)
have this property, as it was replaced by the ``status`` property.

The property is generally of little use to developers. At the time
Expand All @@ -265,7 +265,7 @@ _property: receipt.gasUsed => [[bignumber]]
The amount of gas actually used by this transaction.

_property: receipt.logsBloom => string<[[datahexstring]]>
A [bloom-filter](https:/\/en.wikipedia.org/wiki/Bloom_filter), which
A [bloom-filter](link-wiki-bloomfilter), which
incldues all the addresses and topics included in any log in this
transaction.

Expand Down Expand Up @@ -294,10 +294,10 @@ up to (and including) this transaction.
This is generally of little interest to developers.

_property: receipt.byzantium => boolean
This is true if the block is in a [post-Byzantium Hard Fork](https:/\/eips.ethereum.org/EIPS/eip-609)
This is true if the block is in a [post-Byzantium Hard Fork](link-eip-609)
block.

_property: receipt.status => boolean
The status of a transaction is 1 is successful or 0 if it was
reverted. Only transactions included in blocks [post-Byzantium Hard Fork](https:/\/eips.ethereum.org/EIPS/eip-609)
reverted. Only transactions included in blocks [post-Byzantium Hard Fork](link-eip-609)
have this property.
4 changes: 2 additions & 2 deletions docs.wrm/api/utils/abi.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _subsection: Formats
_heading: JSON String ABI (Solidity Output JSON)

The **JSON ABI Format** is the format that is
[output from the Solidity compiler](https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description).
[output from the Solidity compiler](link-solc-output).

A JSON serialized object is always a string, which represents an Array
of Objects, where each Object has various properties describing the [[abi-fragment]] of the ABI.
Expand All @@ -21,7 +21,7 @@ _heading: Humanb-Readable ABI

The Human-Readable ABI was

[article](https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917)
[article](link-ricmoo-humanreadableabi)

_heading: Output Formats @<abi-outputformats> @src<abi/fragments:FormatTypes>

Expand Down
6 changes: 3 additions & 3 deletions docs.wrm/api/utils/address.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ _heading: ICAP Address @<address-icap>

The **ICAP Address Format** was an early attempt to introduce a checksum
into Ethereum addresses using the popular banking industry's
[IBAN](https:/\/en.wikipedia.org/wiki/International_Bank_Account_Number)
[IBAN](link-wiki-iban)
format with the country code specified as **XE**.

Due to the way IBAN encodes address, only addresses that fit into 30 base-36
Expand Down Expand Up @@ -56,7 +56,7 @@ _property: utils.isAddress(address) => boolean @<utils-isAddress> @SRC<address>
Returns true if //address// is valid (in any supported format).

_property: utils.getIcapAddress(address) => string<[IcapAddress](address-icap)> @<utils-getIcapAddress> @SRC<address>
Returns //address// as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29).
Returns //address// as an [ICAP address](link-icap).
Supports the same restrictions as [utils.getAddress](utils-getAddress).

_property: utils.getContractAddress(transaction) => string<[[address]]> @<utils-getcontractaddress> @SRC<address>
Expand All @@ -65,4 +65,4 @@ used to deploy a contract.

_property: utils.getCreate2Address(from, salt, initCodeHash) => string<[[address]]> @<utils.getCreate2Address> @SRC<address>
Returns the contract address that would result from the given
[CREATE2](https://eips.ethereum.org/EIPS/eip-1014) call.
[CREATE2](link-eip-1014) call.
6 changes: 3 additions & 3 deletions docs.wrm/api/utils/bignumber.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _definition: **//number//**
A number that is within the safe range for JavaScript numbers.

_definition: **//BigInt//**
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
A JavaScript [BigInt](link-js-bigint)
object, on environments that support BigInt.


Expand Down Expand Up @@ -83,7 +83,7 @@ the //bitcount// least significant bits set to zero.

_heading: Two's Compliment

[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
[Two's Complicment](link-wiki-twoscomplement)
is an elegant method used to encode and decode fixed-width signed values
while efficiently preserving mathematic operations.
Most users will not need to interact with these.
Expand Down Expand Up @@ -154,7 +154,7 @@ with very little granularity. For example, there are only 100
cents in a single dollar. However, there are 10^^18^^ **wei** in a
single **ether**.

JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
JavaScript uses [IEEE 754 double-precision binary floating point](link-wiki-ieee754)
numbers to represent numeric values. As a result, there are //holes//
in the integer set after 9,007,199,254,740,991; which is
problematic for //Ethereum// because that is only around 0.009
Expand Down
Loading

0 comments on commit 8eb0190

Please sign in to comment.