diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index 26ed96e978..e77c1c7173 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -51,7 +51,7 @@ abstract contract TaikoEvents { /// @param proofTimeTarget The target time of proof generation /// @param proofTimeIssued The actual time of proof generation /// @param blockFee The fee associated with the proposed block - /// @param adjustmentQuotient The quotient used for adjusting future + /// @param adjustmentQuotient The quotient used for adjusting future /// proof generation time to the target time event ProofParamsChanged( uint64 proofTimeTarget, diff --git a/packages/website/pages/docs/concepts/overview.mdx b/packages/website/pages/docs/concepts/overview.mdx index ab0bd77dfb..b82d98a0fd 100644 --- a/packages/website/pages/docs/concepts/overview.mdx +++ b/packages/website/pages/docs/concepts/overview.mdx @@ -1,16 +1,107 @@ +import Image from "next/image"; + # What is Taiko? -Taiko aims to build a secure, decentralized, and permissionless [rollup](https://www.youtube.com/watch?v=7pWxCklcNsU) on Ethereum. These requirements dictate the following properties: +Taiko is a secure, decentralized, and permissionless [rollup](https://www.youtube.com/watch?v=7pWxCklcNsU) on Ethereum. Taiko achieves this by: -1. All block data required to reconstruct the post-block state needs to be put on Ethereum so it is publicly available. If this would not be the case, Taiko would not only fail to be a rollup but would also fail to be fully decentralized. This data is required so that anyone can know the latest chain state and so that useful new blocks can be appended to the chain. For the decentralization of the proof generation Taiko requires an even stronger requirement: all block data needed to be able to re-execute all work in a block in a step-by-step fashion needs to be made public. This makes it possible for provers to generate a proof for a block using only publicly known data. -2. Creating and proposing blocks should be a fast and efficient process. Anyone should be able to add blocks to the chain on a level playing field, having access to the same chain data at all times. Proposers, of course, should be able to compete on e.g. transaction fees and [Maximal Extractable Value (MEV)](https://ethereum.org/en/developers/docs/mev/). +1. writing all block data required to reconstruct the post-block state to Ethereum. Recording block data to Ethereum as an L1 makes the data decentralized and public. This data is needed for everyone to know the latest chain state to add new blocks to Taiko. Taiko's proof generation requires an even stricter requirement: all executable data must be saved publicly in sequence. Consequently, provers can generate proofs for a block using only publicly known data. +2. creating and proposing blocks should be a fast and efficient process. Anyone should be able to add blocks to the chain on a level playing field, having access to the same chain data at all times. Proposers, of course, should be able to compete on e.g., transaction fees and [Maximal Extractable Value (MEV)](https://ethereum.org/en/developers/docs/mev/). -We achieve this by splitting the block submission process in two parts: +We achieve this by splitting the block submission process into two parts: ## Block proposal -When a block gets proposed the block data is published on Ethereum and the block is appended to the proposed blocks list stored in the [TaikoL1](/docs/reference/contract-documentation/L1/TaikoL1) contract. Once registered, the protocol ensures that _all_ block properties are immutable. This makes the block execution _deterministic_: the post-block state can now be calculated by anyone. As such, the block is immediately _verified_. This also ensures that no one knows more about the latest state than anyone else, as that would create an unfair advantage. +When a block gets proposed, the block data is published on Ethereum, and the block is appended to the proposed blocks list stored in the [TaikoL1](/docs/reference/contract-documentation/L1/TaikoL1) contract. Once registered, the protocol ensures that _all_ block properties are immutable. This makes the block execution _deterministic_: the post-block state can now be calculated by anyone. As such, the block is immediately _verified_. This also ensures that no one knows more about the latest state than anyone else, which would create an unfair advantage. ## Block verification Because the block should already be verified once proposed, it should _not_ be possible for the prover to have any impact on how the block is executed and what the post-block state is. All relevant inputs for the proof generation are verified on L1 directly or indirectly to achieve deterministic block transitions. As all proposed blocks are deterministic, they can be proven in parallel, because all intermediate states between blocks are known and unique. Once a proof is submitted for the block and its parent block, we call the block _on-chain verified_. + +## The L2 block space + +Although block space is much +cheaper than on L1, it is still necessary to adjust +its price in a way to avoid L2 space being abused. +EIP-1559 on Taiko dynamically adjusts the block space price. + +## Rate Limiting using EIP-1559 + +Although rollups can have significantly +higher network capacity than L1s, +this capacity is not without limit. As such the protocol +needs to be able to limit how much work the L2 network +needs to do to keep up with the tip of the chain. Ethereum +already has a mechanism in place to do just that with +that we can use as well. + +
+ proposed +
+At block proposal we keep track of how much work (measured in gas) is required to +process the block, while subtracting the amount of work the Taiko network can handle. +This effectively creates a market for network capacity (in gas) per ETH. This will +impact how expensive Taiko block space is (paid by the block proposer), the higher +the demand the higher the network fee (a fee paid to the Taiko DAO). This way, rate +limiting is achieved in a way that does not simply impose a hard and inefficient +cap on the network, instead this mechanism allows users to utilize the network in +a fair way while allowing the Taiko network to capture the created value. And because +the same mechanism is used on Ethereum it allows Taiko to be Ethereum equivalent +(with some small implementation detail changes) even for this part of its network, +which is not obviously the case for L2s. + +## EIP-1559 Powered Prover fees + +Proving blocks requires significant compute power to calculate the proof +to submit and verify the proof on Ethereum. Provers need +to be compensated for this work as the network needs to +attract provers that are willing to do this work. How much +to pay for a proof is not obvious however: + +1. The Ethereum gas cost to publish/verify a proof + on Ethereum is unpredictable. +2. The proof generation cost does not necessarily + match perfectly with the gas cost. +3. The proof generation cost keeps changing as proving software is optimized and the hardware used + gets faster and cheaper. +4. The proof generation cost depends on how fast a + proof needs to be generated. + +Because the proving cost impacts the transaction fees +paid by the users, the goal is to pay only as much as +required for the network to function well. This means not +underpaying provers because blocks may remain unproven, +but certainly also not overpaying provers so that it doesn’t +make sense to incur very high costs to try and generate +proofs as quickly as absolutely possible. A good balance is +key to a well working solution that takes into account the +needs of the different network participants. +It’s clear that a fixed proving fee does not work. The +protocol should also not be dependent on a single prover +for a block because this will put too much power in the +hands of a single entity that can impact the stable progress +of the chain. + +The network, somehow, has to find the correct price between +two resources where the demand/supply is ever changing. +We can model this problem as a market between the proving +fee (per gas) per proof delay (per time unit), striking +a dynamic balance between proving cost and proof delay. +An additional complication is that the protocol expects +the block proposer to pay the proving fee at block proposal +time. As such, the baseFee of this model is used to charge +the proposer of a block using the total gas used in the block. +This is only an estimate of the actual cost because the +actual cost is only known when the proof is submitted. If +the estimated cost was too high the difference is returned +to the block proposer and the baseFee is decreased. If +the estimated cost was too low extra Taiko tokens are +minted to make up the difference and the baseFee is +increased. To lower the chance that the estimated cost is too +low and extra Taiko tokens need to be minted, a slightly +higher baseFee can be charged to the proposer than the +one predicted by the model. diff --git a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx index c991df6181..89ab33acb1 100644 --- a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx +++ b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx @@ -47,7 +47,7 @@ To stake your TTKOe try using the [staking dashboard](https://staking.l3test.tai Verify you have some prover logs: - `💰 Your block proof was accepted` means you are the first prover and receive the reward. -- `✅ Valid block proven` just means a proposed block was successfully proved on TaikoL1 (by anyone). +- `✅ Block proven` just means a proposed block was successfully proved on TaikoL1 (by anyone). If you are running a node in the background, you can view the logs with `docker compose logs -f`. diff --git a/packages/website/pages/docs/manuals/node-runner-manuals.mdx b/packages/website/pages/docs/manuals/node-runner-manuals.mdx new file mode 100644 index 0000000000..2aac7c8044 --- /dev/null +++ b/packages/website/pages/docs/manuals/node-runner-manuals.mdx @@ -0,0 +1,6 @@ +# Node runner manuals + +These manuals list commonly used commands for node operation and troubleshooting. To setup a node, see the [Guides](/docs/guides). + +- [Grimsvotn L2 node runner manual](/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual) +- [Eldfell L3 node runner manual](/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual) diff --git a/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx b/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx index a68fa366b0..8b9b0873ff 100644 --- a/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx +++ b/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx @@ -39,29 +39,29 @@ docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f ## View execution logs ```sh -docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l2_execution_engine +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_execution_engine ``` ## View client driver logs ```sh -docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_driver +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_taiko_client_driver ``` ## View client proposer logs ```sh -docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_proposer +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_taiko_client_proposer ``` ## View client prover relayer logs ```sh -docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_prover_relayer +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_taiko_client_prover_relayer ``` ## View zkevm prover logs ```sh -docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f zkevm-chain-prover-rpcd +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_zkevm_chain_prover_rpcd ``` diff --git a/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx b/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx index 4b481bca7b..a93d62311f 100644 --- a/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx +++ b/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx @@ -63,5 +63,5 @@ docker compose logs -f taiko_client_prover_relayer ## View zkevm prover logs ```sh -docker compose logs -f zkevm-chain-prover-rpcd +docker compose logs -f zkevm_chain_prover_rpcd ``` diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoConfig.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoConfig.md new file mode 100644 index 0000000000..1082417944 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoConfig.md @@ -0,0 +1,17 @@ +--- +title: TaikoConfig +--- + +## TaikoConfig + +### getConfig + +```solidity +function getConfig() internal pure returns (struct TaikoData.Config) +``` + +#### Return Values + +| Name | Type | Description | +| ---- | ----------------------- | ------------------------------------- | +| [0] | struct TaikoData.Config | config The Taiko configuration object | diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md new file mode 100644 index 0000000000..b808389cc5 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md @@ -0,0 +1,166 @@ +--- +title: TaikoData +--- + +## TaikoData + +### Config + +```solidity +struct Config { + uint256 chainId; + uint256 maxNumProposedBlocks; + uint256 ringBufferSize; + uint256 maxVerificationsPerTx; + uint64 blockMaxGasLimit; + uint64 maxTransactionsPerBlock; + uint64 maxBytesPerTxList; + uint256 txListCacheExpiry; + uint256 proofCooldownPeriod; + uint256 systemProofCooldownPeriod; + uint256 realProofSkipSize; + uint256 ethDepositGas; + uint256 ethDepositMaxFee; + uint256 ethDepositRingBufferSize; + uint64 ethDepositMinCountPerBlock; + uint64 ethDepositMaxCountPerBlock; + uint96 ethDepositMaxAmount; + uint96 ethDepositMinAmount; + bool relaySignalRoot; +} +``` + +### StateVariables + +```solidity +struct StateVariables { + uint64 blockFee; + uint64 genesisHeight; + uint64 genesisTimestamp; + uint64 numBlocks; + uint64 lastVerifiedBlockId; + uint64 nextEthDepositToProcess; + uint64 numEthDeposits; +} +``` + +### BlockMetadataInput + +```solidity +struct BlockMetadataInput { + bytes32 txListHash; + address beneficiary; + uint32 gasLimit; + uint24 txListByteStart; + uint24 txListByteEnd; + uint8 cacheTxListInfo; +} +``` + +### BlockMetadata + +```solidity +struct BlockMetadata { + uint64 id; + uint64 timestamp; + uint64 l1Height; + bytes32 l1Hash; + bytes32 mixHash; + bytes32 txListHash; + uint24 txListByteStart; + uint24 txListByteEnd; + uint32 gasLimit; + address beneficiary; + address treasury; + struct TaikoData.EthDeposit[] depositsProcessed; +} +``` + +### BlockEvidence + +```solidity +struct BlockEvidence { + bytes32 metaHash; + bytes32 parentHash; + bytes32 blockHash; + bytes32 signalRoot; + bytes32 graffiti; + address prover; + uint32 parentGasUsed; + uint32 gasUsed; + uint16 verifierId; + bytes proof; +} +``` + +### ForkChoice + +```solidity +struct ForkChoice { + bytes32 key; + bytes32 blockHash; + bytes32 signalRoot; + uint64 provenAt; + address prover; + uint32 gasUsed; +} +``` + +### Block + +```solidity +struct Block { + mapping(uint256 => struct TaikoData.ForkChoice) forkChoices; + uint64 blockId; + uint64 proposedAt; + uint24 nextForkChoiceId; + uint24 verifiedForkChoiceId; + bytes32 metaHash; + address proposer; +} +``` + +### TxListInfo + +```solidity +struct TxListInfo { + uint64 validSince; + uint24 size; +} +``` + +### EthDeposit + +```solidity +struct EthDeposit { + address recipient; + uint96 amount; + uint64 id; +} +``` + +### State + +```solidity +struct State { + mapping(uint256 => struct TaikoData.Block) blocks; + mapping(uint256 => mapping(bytes32 => mapping(uint32 => uint256))) forkChoiceIds; + mapping(address => uint256) taikoTokenBalances; + mapping(bytes32 => struct TaikoData.TxListInfo) txListInfo; + mapping(uint256 => uint256) ethDeposits; + uint64 genesisHeight; + uint64 genesisTimestamp; + uint16 __reserved70; + uint48 __reserved71; + uint64 __reserved72; + uint64 __reserved80; + uint64 numEthDeposits; + uint64 numBlocks; + uint64 nextEthDepositToProcess; + uint64 blockFee; + uint64 __reserved90; + uint64 lastVerifiedBlockId; + uint64 __reserved91; + uint256[42] __gap; +} +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoErrors.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoErrors.md new file mode 100644 index 0000000000..d03d35973e --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoErrors.md @@ -0,0 +1,131 @@ +--- +title: TaikoErrors +--- + +## TaikoErrors + +### L1_ALREADY_PROVEN + +```solidity +error L1_ALREADY_PROVEN() +``` + +### L1_BLOCK_ID + +```solidity +error L1_BLOCK_ID() +``` + +### L1_EVIDENCE_MISMATCH + +```solidity +error L1_EVIDENCE_MISMATCH(bytes32 expected, bytes32 actual) +``` + +### L1_FORK_CHOICE_NOT_FOUND + +```solidity +error L1_FORK_CHOICE_NOT_FOUND() +``` + +### L1_INVALID_CONFIG + +```solidity +error L1_INVALID_CONFIG() +``` + +### L1_INVALID_ETH_DEPOSIT + +```solidity +error L1_INVALID_ETH_DEPOSIT() +``` + +### L1_INVALID_EVIDENCE + +```solidity +error L1_INVALID_EVIDENCE() +``` + +### L1_INVALID_METADATA + +```solidity +error L1_INVALID_METADATA() +``` + +### L1_INVALID_PARAM + +```solidity +error L1_INVALID_PARAM() +``` + +### L1_INVALID_PROOF + +```solidity +error L1_INVALID_PROOF() +``` + +### L1_INVALID_PROOF_OVERWRITE + +```solidity +error L1_INVALID_PROOF_OVERWRITE() +``` + +### L1_NOT_SPECIAL_PROVER + +```solidity +error L1_NOT_SPECIAL_PROVER() +``` + +### L1_ORACLE_PROVER_DISABLED + +```solidity +error L1_ORACLE_PROVER_DISABLED() +``` + +### L1_SAME_PROOF + +```solidity +error L1_SAME_PROOF() +``` + +### L1_SYSTEM_PROVER_DISABLED + +```solidity +error L1_SYSTEM_PROVER_DISABLED() +``` + +### L1_SYSTEM_PROVER_PROHIBITED + +```solidity +error L1_SYSTEM_PROVER_PROHIBITED() +``` + +### L1_TOO_MANY_BLOCKS + +```solidity +error L1_TOO_MANY_BLOCKS() +``` + +### L1_TX_LIST_NOT_EXIST + +```solidity +error L1_TX_LIST_NOT_EXIST() +``` + +### L1_TX_LIST_HASH + +```solidity +error L1_TX_LIST_HASH() +``` + +### L1_TX_LIST_RANGE + +```solidity +error L1_TX_LIST_RANGE() +``` + +### L1_TX_LIST + +```solidity +error L1_TX_LIST() +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md new file mode 100644 index 0000000000..94cc759759 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md @@ -0,0 +1,87 @@ +--- +title: TaikoEvents +--- + +## TaikoEvents + +### BlockProposed + +```solidity +event BlockProposed(uint256 id, struct TaikoData.BlockMetadata meta, uint64 blockFee) +``` + +_Emitted when a block is proposed_ + +#### Parameters + +| Name | Type | Description | +| -------- | ------------------------------ | ------------------------------------------ | +| id | uint256 | The ID of the proposed block | +| meta | struct TaikoData.BlockMetadata | The metadata of the proposed block | +| blockFee | uint64 | The fee associated with the proposed block | + +### BlockProven + +```solidity +event BlockProven(uint256 id, bytes32 parentHash, bytes32 blockHash, bytes32 signalRoot, address prover, uint32 parentGasUsed) +``` + +_Emitted when a block is proven_ + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ----------------------------------- | +| id | uint256 | The ID of the proven block | +| parentHash | bytes32 | The hash of the parent block | +| blockHash | bytes32 | The hash of the proven block | +| signalRoot | bytes32 | The signal root of the proven block | +| prover | address | The address of the prover | +| parentGasUsed | uint32 | The gas used by the parent block | + +### BlockVerified + +```solidity +event BlockVerified(uint256 id, bytes32 blockHash, uint64 reward) +``` + +_Emitted when a block is verified_ + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| id | uint256 | The ID of the verified block | +| blockHash | bytes32 | The hash of the verified block | +| reward | uint64 | The amount of token rewarded to the verification | + +### EthDeposited + +```solidity +event EthDeposited(struct TaikoData.EthDeposit deposit) +``` + +_Emitted when an Ethereum deposit is made_ + +#### Parameters + +| Name | Type | Description | +| ------- | --------------------------- | ----------------------------------------- | +| deposit | struct TaikoData.EthDeposit | The information of the deposited Ethereum | + +### ProofParamsChanged + +```solidity +event ProofParamsChanged(uint64 proofTimeTarget, uint64 proofTimeIssued, uint64 blockFee, uint16 adjustmentQuotient) +``` + +_Emitted when the proof parameters are changed_ + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------- | +| proofTimeTarget | uint64 | The target time of proof generation | +| proofTimeIssued | uint64 | The actual time of proof generation | +| blockFee | uint64 | The fee associated with the proposed block | +| adjustmentQuotient | uint16 | The quotient used for adjusting future proof generation time to the target time | diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md new file mode 100644 index 0000000000..e340c6aaf1 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md @@ -0,0 +1,149 @@ +--- +title: TaikoL1 +--- + +## TaikoL1 + +### state + +```solidity +struct TaikoData.State state +``` + +### receive + +```solidity +receive() external payable +``` + +### init + +```solidity +function init(address _addressManager, bytes32 _genesisBlockHash, uint64 _initBlockFee) external +``` + +Initialize the rollup. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------------------- | +| \_addressManager | address | The AddressManager address. | +| \_genesisBlockHash | bytes32 | The block hash of the genesis block. | +| \_initBlockFee | uint64 | Initial (reasonable) block fee value. | + +### proposeBlock + +```solidity +function proposeBlock(bytes input, bytes txList) external returns (struct TaikoData.BlockMetadata meta) +``` + +Propose a Taiko L2 block. + +#### Parameters + +| Name | Type | Description | +| ------ | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| input | bytes | An abi-encoded BlockMetadataInput that the actual L2 block header must satisfy. | +| txList | bytes | A list of transactions in this block, encoded with RLP. Note, in the corresponding L2 block an _anchor transaction_ will be the first transaction in the block -- if there are `n` transactions in `txList`, then there will be up to `n + 1` transactions in the L2 block. | + +### proveBlock + +```solidity +function proveBlock(uint256 blockId, bytes input) external +``` + +Prove a block with a zero-knowledge proof. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------------------------------------------------------------- | +| blockId | uint256 | The index of the block to prove. This is also used to select the right implementation version. | +| input | bytes | An abi-encoded TaikoData.BlockEvidence object. | + +### verifyBlocks + +```solidity +function verifyBlocks(uint256 maxBlocks) external +``` + +Verify up to N blocks. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------- | +| maxBlocks | uint256 | Max number of blocks to verify. | + +### depositEtherToL2 + +```solidity +function depositEtherToL2(address recipient) public payable +``` + +### canDepositEthToL2 + +```solidity +function canDepositEthToL2(uint256 amount) public view returns (bool) +``` + +### getTaikoTokenBalance + +```solidity +function getTaikoTokenBalance(address addr) public view returns (uint256) +``` + +### getBlockFee + +```solidity +function getBlockFee() public view returns (uint64) +``` + +### getBlock + +```solidity +function getBlock(uint256 blockId) public view returns (bytes32 _metaHash, address _proposer, uint64 _proposedAt) +``` + +### getForkChoice + +```solidity +function getForkChoice(uint256 blockId, bytes32 parentHash, uint32 parentGasUsed) public view returns (struct TaikoData.ForkChoice) +``` + +### getCrossChainBlockHash + +```solidity +function getCrossChainBlockHash(uint256 blockId) public view returns (bytes32) +``` + +### getCrossChainSignalRoot + +```solidity +function getCrossChainSignalRoot(uint256 blockId) public view returns (bytes32) +``` + +### getStateVariables + +```solidity +function getStateVariables() public view returns (struct TaikoData.StateVariables) +``` + +### getConfig + +```solidity +function getConfig() public pure virtual returns (struct TaikoData.Config) +``` + +### getVerifierName + +```solidity +function getVerifierName(uint16 id) public pure returns (bytes32) +``` + +--- + +## title: ProxiedTaikoL1 + +## ProxiedTaikoL1 diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoToken.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoToken.md new file mode 100644 index 0000000000..a362df0036 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoToken.md @@ -0,0 +1,165 @@ +--- +title: LibTaikoTokenConfig +--- + +## LibTaikoTokenConfig + +### DECIMALS + +```solidity +uint8 DECIMALS +``` + +--- + +## title: TaikoToken + +## TaikoToken + +### Mint + +```solidity +event Mint(address account, uint256 amount) +``` + +### Burn + +```solidity +event Burn(address account, uint256 amount) +``` + +### TKO_INVALID_ADDR + +```solidity +error TKO_INVALID_ADDR() +``` + +### TKO_INVALID_PREMINT_PARAMS + +```solidity +error TKO_INVALID_PREMINT_PARAMS() +``` + +### TKO_MINT_DISALLOWED + +```solidity +error TKO_MINT_DISALLOWED() +``` + +### init + +```solidity +function init(address _addressManager, string _name, string _symbol, address[] _premintRecipients, uint256[] _premintAmounts) public +``` + +### snapshot + +```solidity +function snapshot() public +``` + +### pause + +```solidity +function pause() public +``` + +### unpause + +```solidity +function unpause() public +``` + +### mint + +```solidity +function mint(address to, uint256 amount) public +``` + +### burn + +```solidity +function burn(address from, uint256 amount) public +``` + +### transfer + +```solidity +function transfer(address to, uint256 amount) public returns (bool) +``` + +\_See {IERC20-transfer}. + +Requirements: + +- `to` cannot be the zero address. +- the caller must have a balance of at least `amount`.\_ + +### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 amount) public returns (bool) +``` + +\_See {IERC20-transferFrom}. + +Emits an {Approval} event indicating the updated allowance. This is not +required by the EIP. See the note at the beginning of {ERC20}. + +NOTE: Does not update the allowance if the current allowance +is the maximum `uint256`. + +Requirements: + +- `from` and `to` cannot be the zero address. +- `from` must have a balance of at least `amount`. +- the caller must have allowance for `from`'s tokens of at least + `amount`.\_ + +### decimals + +```solidity +function decimals() public pure returns (uint8) +``` + +\_Returns the number of decimals used to get its user representation. +For example, if `decimals` equals `2`, a balance of `505` tokens should +be displayed to a user as `5.05` (`505 / 10 ** 2`). + +Tokens usually opt for a value of 18, imitating the relationship between +Ether and Wei. This is the value {ERC20} uses, unless this function is +overridden; + +NOTE: This information is only used for _display_ purposes: it in +no way affects any of the arithmetic of the contract, including +{IERC20-balanceOf} and {IERC20-transfer}.\_ + +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer(address from, address to, uint256 amount) internal +``` + +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer(address from, address to, uint256 amount) internal +``` + +### \_mint + +```solidity +function _mint(address to, uint256 amount) internal +``` + +### \_burn + +```solidity +function _burn(address from, uint256 amount) internal +``` + +--- + +## title: ProxiedTaikoToken + +## ProxiedTaikoToken diff --git a/packages/website/pages/docs/reference/contract-documentation/L2/LibL2Consts.md b/packages/website/pages/docs/reference/contract-documentation/L2/LibL2Consts.md new file mode 100644 index 0000000000..ab814286e0 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L2/LibL2Consts.md @@ -0,0 +1,11 @@ +--- +title: LibL2Consts +--- + +## LibL2Consts + +### ANCHOR_GAS_COST + +```solidity +uint64 ANCHOR_GAS_COST +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2.md b/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2.md new file mode 100644 index 0000000000..533e2c0650 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2.md @@ -0,0 +1,215 @@ +--- +title: TaikoL2 +--- + +## TaikoL2 + +### VerifiedBlock + +```solidity +struct VerifiedBlock { + bytes32 blockHash; + bytes32 signalRoot; +} +``` + +### EIP1559Params + +```solidity +struct EIP1559Params { + uint64 basefee; + uint64 gasIssuedPerSecond; + uint64 gasExcessMax; + uint64 gasTarget; + uint64 ratio2x1x; +} +``` + +### EIP1559Config + +```solidity +struct EIP1559Config { + uint128 yscale; + uint64 xscale; + uint64 gasIssuedPerSecond; +} +``` + +### publicInputHash + +```solidity +bytes32 publicInputHash +``` + +### parentTimestamp + +```solidity +uint64 parentTimestamp +``` + +### latestSyncedL1Height + +```solidity +uint64 latestSyncedL1Height +``` + +### gasExcess + +```solidity +uint64 gasExcess +``` + +### Anchored + +```solidity +event Anchored(uint64 number, uint64 basefee, uint64 gaslimit, uint64 timestamp, bytes32 parentHash, uint256 prevrandao, address coinbase, uint32 chainid) +``` + +### L2_BASEFEE_MISMATCH + +```solidity +error L2_BASEFEE_MISMATCH(uint64 expected, uint64 actual) +``` + +### L2_INVALID_1559_PARAMS + +```solidity +error L2_INVALID_1559_PARAMS() +``` + +### L2_INVALID_CHAIN_ID + +```solidity +error L2_INVALID_CHAIN_ID() +``` + +### L2_INVALID_SENDER + +```solidity +error L2_INVALID_SENDER() +``` + +### L2_PUBLIC_INPUT_HASH_MISMATCH + +```solidity +error L2_PUBLIC_INPUT_HASH_MISMATCH(bytes32 expected, bytes32 actual) +``` + +### L2_TOO_LATE + +```solidity +error L2_TOO_LATE() +``` + +### M1559_UNEXPECTED_CHANGE + +```solidity +error M1559_UNEXPECTED_CHANGE(uint64 expected, uint64 actual) +``` + +### M1559_OUT_OF_STOCK + +```solidity +error M1559_OUT_OF_STOCK() +``` + +### init + +```solidity +function init(address _addressManager, struct TaikoL2.EIP1559Params _param1559) external +``` + +### anchor + +```solidity +function anchor(bytes32 l1Hash, bytes32 l1SignalRoot, uint64 l1Height, uint64 parentGasUsed) external +``` + +Persist the latest L1 block height and hash to L2 for cross-layer +message verification (eg. bridging). This function will also check +certain block-level global variables because they are not part of the +Trie structure. + +A circuit will verify the integrity among: + +- l1Hash, l1SignalRoot, and l1SignalServiceAddress +- (l1Hash and l1SignalServiceAddress) are both hashed into of the + ZKP's instance. + +This transaction shall be the first transaction in every L2 block. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | --------------------------------------------------------- | +| l1Hash | bytes32 | The latest L1 block hash when this block was proposed. | +| l1SignalRoot | bytes32 | The latest value of the L1 "signal service storage root". | +| l1Height | uint64 | The latest L1 block height when this block was proposed. | +| parentGasUsed | uint64 | the gas used in the parent block. | + +### getBasefee + +```solidity +function getBasefee(uint32 timeSinceParent, uint64 gasLimit, uint64 parentGasUsed) public view returns (uint256 _basefee) +``` + +### getCrossChainBlockHash + +```solidity +function getCrossChainBlockHash(uint256 number) public view returns (bytes32) +``` + +Returns the cross-chain block hash at the given block number. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------- | +| number | uint256 | The block number. Use 0 for the latest block. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------------- | +| [0] | bytes32 | The cross-chain block hash. | + +### getCrossChainSignalRoot + +```solidity +function getCrossChainSignalRoot(uint256 number) public view returns (bytes32) +``` + +Returns the cross-chain signal service storage root at the given +block number. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------- | +| number | uint256 | The block number. Use 0 for the latest block. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------------- | +| [0] | bytes32 | The cross-chain signal service storage root. | + +### getBlockHash + +```solidity +function getBlockHash(uint256 number) public view returns (bytes32) +``` + +### getEIP1559Config + +```solidity +function getEIP1559Config() public view virtual returns (struct TaikoL2.EIP1559Config) +``` + +_Overide this funciton to return a constant EIP1559Config object_ + +--- + +## title: ProxiedTaikoL2 + +## ProxiedTaikoL2 diff --git a/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2Signer.md b/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2Signer.md new file mode 100644 index 0000000000..f918f32a6e --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/L2/TaikoL2Signer.md @@ -0,0 +1,29 @@ +--- +title: TaikoL2Signer +--- + +## TaikoL2Signer + +### GOLDEN_TOUCH_ADDRESS + +```solidity +address GOLDEN_TOUCH_ADDRESS +``` + +### GOLDEN_TOUCH_PRIVATEKEY + +```solidity +uint256 GOLDEN_TOUCH_PRIVATEKEY +``` + +### L2_INVALID_GOLDEN_TOUCH_K + +```solidity +error L2_INVALID_GOLDEN_TOUCH_K() +``` + +### signAnchor + +```solidity +function signAnchor(bytes32 digest, uint8 k) public view returns (uint8 v, uint256 r, uint256 s) +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/Bridge.md b/packages/website/pages/docs/reference/contract-documentation/bridge/Bridge.md new file mode 100644 index 0000000000..5afa35c36b --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/Bridge.md @@ -0,0 +1,311 @@ +--- +title: Bridge +--- + +## Bridge + +This contract is a Bridge contract which is deployed on both L1 and L2. Mostly +a thin wrapper +which calls the library implementations. See _IBridge_ for more details. + +_The code hash for the same address on L1 and L2 may be different._ + +### MessageStatusChanged + +```solidity +event MessageStatusChanged(bytes32 msgHash, enum LibBridgeStatus.MessageStatus status, address transactor) +``` + +### DestChainEnabled + +```solidity +event DestChainEnabled(uint256 chainId, bool enabled) +``` + +### receive + +```solidity +receive() external payable +``` + +Allow Bridge to receive ETH from the TaikoL1, TokenVault or EtherVault. + +### init + +```solidity +function init(address _addressManager) external +``` + +Initializer to be called after being deployed behind a proxy. + +_Initializer function to setup the EssentialContract._ + +#### Parameters + +| Name | Type | Description | +| ---------------- | ------- | ------------------------------------------- | +| \_addressManager | address | The address of the AddressManager contract. | + +### sendMessage + +```solidity +function sendMessage(struct IBridge.Message message) external payable returns (bytes32 msgHash) +``` + +Sends a message from the current chain to the destination chain specified +in the message. + +_Sends a message by calling the LibBridgeSend.sendMessage library +function._ + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------- | ---------------------------------- | +| message | struct IBridge.Message | The message to send. (See IBridge) | + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | -------------------------------------- | +| msgHash | bytes32 | The hash of the message that was sent. | + +### releaseEther + +```solidity +function releaseEther(struct IBridge.Message message, bytes proof) external +``` + +Releases the Ether locked in the bridge as part of a cross-chain +transfer. + +_Releases the Ether by calling the LibBridgeRelease.releaseEther +library function._ + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------- | ----------------------------------------------------------------------- | +| message | struct IBridge.Message | The message containing the details of the Ether transfer. (See IBridge) | +| proof | bytes | The proof of the cross-chain transfer. | + +### processMessage + +```solidity +function processMessage(struct IBridge.Message message, bytes proof) external +``` + +Processes a message received from another chain. + +_Processes the message by calling the LibBridgeProcess.processMessage +library function._ + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------- | -------------------------------------- | +| message | struct IBridge.Message | The message to process. | +| proof | bytes | The proof of the cross-chain transfer. | + +### retryMessage + +```solidity +function retryMessage(struct IBridge.Message message, bool isLastAttempt) external +``` + +Retries sending a message that previously failed to send. + +_Retries the message by calling the LibBridgeRetry.retryMessage +library function._ + +#### Parameters + +| Name | Type | Description | +| ------------- | ---------------------- | --------------------------------------------------------------- | +| message | struct IBridge.Message | The message to retry. | +| isLastAttempt | bool | Specifies whether this is the last attempt to send the message. | + +### isMessageSent + +```solidity +function isMessageSent(bytes32 msgHash) public view virtual returns (bool) +``` + +Check if the message with the given hash has been sent. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------ | +| msgHash | bytes32 | The hash of the message. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------------------------------------------------------- | +| [0] | bool | Returns true if the message has been sent, false otherwise. | + +### isMessageReceived + +```solidity +function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) public view virtual returns (bool) +``` + +Check if the message with the given hash has been received. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ----------------------------- | +| msgHash | bytes32 | The hash of the message. | +| srcChainId | uint256 | The source chain ID. | +| proof | bytes | The proof of message receipt. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | --------------------------------------------------------------- | +| [0] | bool | Returns true if the message has been received, false otherwise. | + +### isMessageFailed + +```solidity +function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) public view virtual returns (bool) +``` + +Check if the message with the given hash has failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | ----------------------------- | +| msgHash | bytes32 | The hash of the message. | +| destChainId | uint256 | The destination chain ID. | +| proof | bytes | The proof of message failure. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | -------------------------------------------------------- | +| [0] | bool | Returns true if the message has failed, false otherwise. | + +### getMessageStatus + +```solidity +function getMessageStatus(bytes32 msgHash) public view virtual returns (enum LibBridgeStatus.MessageStatus) +``` + +Get the status of the message with the given hash. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------ | +| msgHash | bytes32 | The hash of the message. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---------------------------------- | ---------------------------------- | +| [0] | enum LibBridgeStatus.MessageStatus | Returns the status of the message. | + +### context + +```solidity +function context() public view returns (struct IBridge.Context) +``` + +Get the current context + +#### Return Values + +| Name | Type | Description | +| ---- | ---------------------- | ---------------------------- | +| [0] | struct IBridge.Context | Returns the current context. | + +### isEtherReleased + +```solidity +function isEtherReleased(bytes32 msgHash) public view returns (bool) +``` + +Check if the Ether associated with the given message hash has been +released. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------ | +| msgHash | bytes32 | The hash of the message. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ------------------------------------------------------------- | +| [0] | bool | Returns true if the Ether has been released, false otherwise. | + +### isDestChainEnabled + +```solidity +function isDestChainEnabled(uint256 _chainId) public view returns (bool enabled) +``` + +Check if the destination chain with the given ID is enabled. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | -------------------- | +| \_chainId | uint256 | The ID of the chain. | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ------------------------------------------------------------------ | +| enabled | bool | Returns true if the destination chain is enabled, false otherwise. | + +### hashMessage + +```solidity +function hashMessage(struct IBridge.Message message) public pure returns (bytes32) +``` + +Compute the hash of a given message. + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------- | ------------------------------------ | +| message | struct IBridge.Message | The message to compute the hash for. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------- | +| [0] | bytes32 | Returns the hash of the message. | + +### getMessageStatusSlot + +```solidity +function getMessageStatusSlot(bytes32 msgHash) public pure returns (bytes32) +``` + +Get the slot associated with a given message hash status. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------ | +| msgHash | bytes32 | The hash of the message. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------------------------- | +| [0] | bytes32 | Returns the slot associated with the given message hash status. | + +--- + +## title: ProxiedBridge + +## ProxiedBridge diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/BridgeErrors.md b/packages/website/pages/docs/reference/contract-documentation/bridge/BridgeErrors.md new file mode 100644 index 0000000000..0ad96574b0 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/BridgeErrors.md @@ -0,0 +1,182 @@ +--- +title: BridgeErrors +--- + +## BridgeErrors + +### B_CANNOT_RECEIVE + +```solidity +error B_CANNOT_RECEIVE() +``` + +Emitted when the contract is not intended to receive Ether + +### B_DENIED + +```solidity +error B_DENIED() +``` + +Emitted when an operation is denied due to incorrect permissions + +### B_ERC20_CANNOT_RECEIVE + +```solidity +error B_ERC20_CANNOT_RECEIVE() +``` + +Emitted when the contract is not designed to receive ERC20 tokens + +### B_ETHER_RELEASED_ALREADY + +```solidity +error B_ETHER_RELEASED_ALREADY() +``` + +Emitted when Ether has already been released as part of a transfer + +### B_EV_DO_NOT_BURN + +```solidity +error B_EV_DO_NOT_BURN() +``` + +Emitted when attempting to burn Ether in EtherVault + +### B_EV_NOT_AUTHORIZED + +```solidity +error B_EV_NOT_AUTHORIZED() +``` + +Emitted when an unauthorized action is attempted in EtherVault + +### B_EV_PARAM + +```solidity +error B_EV_PARAM() +``` + +Emitted when an incorrect parameter is passed in EtherVault + +### B_FAILED_TRANSFER + +```solidity +error B_FAILED_TRANSFER() +``` + +Emitted when an ERC20 token transfer fails + +### B_FORBIDDEN + +```solidity +error B_FORBIDDEN() +``` + +Emitted when an action is forbidden + +### B_GAS_LIMIT + +```solidity +error B_GAS_LIMIT() +``` + +Emitted when the gas limit for an operation is exceeded + +### B_INCORRECT_VALUE + +```solidity +error B_INCORRECT_VALUE() +``` + +Emitted when an incorrect value is used in an operation + +### B_INIT_PARAM_ERROR + +```solidity +error B_INIT_PARAM_ERROR() +``` + +Emitted when an incorrect parameter is passed during initialization + +### B_MSG_HASH_NULL + +```solidity +error B_MSG_HASH_NULL() +``` + +Emitted when a null message hash is used + +### B_MSG_NON_RETRIABLE + +```solidity +error B_MSG_NON_RETRIABLE() +``` + +Emitted when a non-retriable message is retried + +### B_MSG_NOT_FAILED + +```solidity +error B_MSG_NOT_FAILED() +``` + +Emitted when a message that hasn't failed is retried + +### B_NULL_APP_ADDR + +```solidity +error B_NULL_APP_ADDR() +``` + +Emitted when a null address is used in an application + +### B_OWNER_IS_NULL + +```solidity +error B_OWNER_IS_NULL() +``` + +Emitted when a null owner address is used + +### B_SIGNAL_NOT_RECEIVED + +```solidity +error B_SIGNAL_NOT_RECEIVED() +``` + +Emitted when a signal has not been received + +### B_STATUS_MISMATCH + +```solidity +error B_STATUS_MISMATCH() +``` + +Emitted when the status of an operation does not match the expected +status + +### B_WRONG_CHAIN_ID + +```solidity +error B_WRONG_CHAIN_ID() +``` + +Emitted when an incorrect chain ID is used + +### B_WRONG_TO_ADDRESS + +```solidity +error B_WRONG_TO_ADDRESS() +``` + +Emitted when an incorrect recipient address is used + +### B_ZERO_SIGNAL + +```solidity +error B_ZERO_SIGNAL() +``` + +Emitted when a signal of zero is used diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/BridgedERC20.md b/packages/website/pages/docs/reference/contract-documentation/bridge/BridgedERC20.md new file mode 100644 index 0000000000..d00e4948be --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/BridgedERC20.md @@ -0,0 +1,160 @@ +--- +title: BridgedERC20 +--- + +## BridgedERC20 + +This contract is an upgradeable ERC20 contract that represents tokens bridged +from another chain. + +### srcToken + +```solidity +address srcToken +``` + +### srcChainId + +```solidity +uint256 srcChainId +``` + +### BridgeMint + +```solidity +event BridgeMint(address account, uint256 amount) +``` + +### BridgeBurn + +```solidity +event BridgeBurn(address account, uint256 amount) +``` + +### init + +```solidity +function init(address _addressManager, address _srcToken, uint256 _srcChainId, uint8 _decimals, string _symbol, string _name) external +``` + +Initializes the contract. + +_Different BridgedERC20 Contract to be deployed +per unique \_srcToken i.e. one for USDC, one for USDT etc._ + +#### Parameters + +| Name | Type | Description | +| ---------------- | ------- | ------------------------------------------------- | +| \_addressManager | address | The address manager. | +| \_srcToken | address | The source token address. | +| \_srcChainId | uint256 | The source chain ID. | +| \_decimals | uint8 | The number of decimal places of the source token. | +| \_symbol | string | The symbol of the token. | +| \_name | string | The name of the token. | + +### bridgeMintTo + +```solidity +function bridgeMintTo(address account, uint256 amount) public +``` + +Mints tokens to an account. + +_Only a TokenVault can call this function._ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------ | +| account | address | The account to mint tokens to. | +| amount | uint256 | The amount of tokens to mint. | + +### bridgeBurnFrom + +```solidity +function bridgeBurnFrom(address account, uint256 amount) public +``` + +Burns tokens from an account. + +_Only a TokenVault can call this function._ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| account | address | The account to burn tokens from. | +| amount | uint256 | The amount of tokens to burn. | + +### transfer + +```solidity +function transfer(address to, uint256 amount) public returns (bool) +``` + +Transfers tokens from the caller to another account. + +_Any address can call this. Caller must have at least 'amount' to +call this._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------------- | +| to | address | The account to transfer tokens to. | +| amount | uint256 | The amount of tokens to transfer. | + +### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 amount) public returns (bool) +``` + +Transfers tokens from one account to another account. + +_Any address can call this. Caller must have allowance of at least +'amount' for 'from's tokens._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------------------ | +| from | address | The account to transfer tokens from. | +| to | address | The account to transfer tokens to. | +| amount | uint256 | The amount of tokens to transfer. | + +### decimals + +```solidity +function decimals() public view returns (uint8) +``` + +Gets the number of decimal places of the token. + +#### Return Values + +| Name | Type | Description | +| ---- | ----- | ------------------------------------------ | +| [0] | uint8 | The number of decimal places of the token. | + +### source + +```solidity +function source() public view returns (address, uint256) +``` + +Gets the source token address and the source chain ID. + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------------- | +| [0] | address | The source token address and the source chain ID. | +| [1] | uint256 | | + +--- + +## title: ProxiedBridgedERC20 + +## ProxiedBridgedERC20 diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/EtherVault.md b/packages/website/pages/docs/reference/contract-documentation/bridge/EtherVault.md new file mode 100644 index 0000000000..4530e4c27a --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/EtherVault.md @@ -0,0 +1,118 @@ +--- +title: EtherVault +--- + +## EtherVault + +This contract is initialized with 2^128 Ether and allows authorized addresses +to release Ether. + +_Only the contract owner can authorize or deauthorize addresses._ + +### Authorized + +```solidity +event Authorized(address addr, bool authorized) +``` + +### EtherReleased + +```solidity +event EtherReleased(address to, uint256 amount) +``` + +### onlyAuthorized + +```solidity +modifier onlyAuthorized() +``` + +### receive + +```solidity +receive() external payable +``` + +Function to receive Ether + +_Only authorized addresses can send Ether to the contract_ + +### init + +```solidity +function init(address addressManager) external +``` + +Initialize the contract with an address manager + +#### Parameters + +| Name | Type | Description | +| -------------- | ------- | ---------------------------------- | +| addressManager | address | The address of the address manager | + +### releaseEther + +```solidity +function releaseEther(uint256 amount) public +``` + +Transfer Ether from EtherVault to the sender, checking that the sender +is authorized. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| amount | uint256 | Amount of Ether to send. | + +### releaseEther + +```solidity +function releaseEther(address recipient, uint256 amount) public +``` + +Transfer Ether from EtherVault to a designated address, checking that the +sender is authorized. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------- | +| recipient | address | Address to receive Ether. | +| amount | uint256 | Amount of ether to send. | + +### authorize + +```solidity +function authorize(address addr, bool authorized) public +``` + +Set the authorized status of an address, only the owner can call this. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ---------------------------------------- | +| addr | address | Address to set the authorized status of. | +| authorized | bool | Authorized status to set. | + +### isAuthorized + +```solidity +function isAuthorized(address addr) public view returns (bool) +``` + +Get the authorized status of an address. + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| addr | address | Address to get the authorized status of. | + +--- + +## title: ProxiedEtherVault + +## ProxiedEtherVault diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/IBridge.md b/packages/website/pages/docs/reference/contract-documentation/bridge/IBridge.md new file mode 100644 index 0000000000..c159a78bdc --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/IBridge.md @@ -0,0 +1,113 @@ +--- +title: IBridge +--- + +## IBridge + +Bridge interface. + +_Ether is held by Bridges on L1 and by the EtherVault on L2, +not TokenVaults._ + +### Message + +```solidity +struct Message { + uint256 id; + address sender; + uint256 srcChainId; + uint256 destChainId; + address owner; + address to; + address refundAddress; + uint256 depositValue; + uint256 callValue; + uint256 processingFee; + uint256 gasLimit; + bytes data; + string memo; +} +``` + +### Context + +```solidity +struct Context { + bytes32 msgHash; + address sender; + uint256 srcChainId; +} +``` + +### SignalSent + +```solidity +event SignalSent(address sender, bytes32 msgHash) +``` + +### MessageSent + +```solidity +event MessageSent(bytes32 msgHash, struct IBridge.Message message) +``` + +### EtherReleased + +```solidity +event EtherReleased(bytes32 msgHash, address to, uint256 amount) +``` + +### sendMessage + +```solidity +function sendMessage(struct IBridge.Message message) external payable returns (bytes32 msgHash) +``` + +Sends a message to the destination chain and takes custody +of Ether required in this contract. All extra Ether will be refunded. + +### releaseEther + +```solidity +function releaseEther(struct IBridge.Message message, bytes proof) external +``` + +### isMessageSent + +```solidity +function isMessageSent(bytes32 msgHash) external view returns (bool) +``` + +Checks if a msgHash has been stored on the bridge contract by the +current address. + +### isMessageReceived + +```solidity +function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) external view returns (bool) +``` + +Checks if a msgHash has been received on the destination chain and +sent by the src chain. + +### isMessageFailed + +```solidity +function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) external view returns (bool) +``` + +Checks if a msgHash has been failed on the destination chain. + +### context + +```solidity +function context() external view returns (struct IBridge.Context context) +``` + +Returns the bridge state context. + +### hashMessage + +```solidity +function hashMessage(struct IBridge.Message message) external pure returns (bytes32) +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/bridge/TokenVault.md b/packages/website/pages/docs/reference/contract-documentation/bridge/TokenVault.md new file mode 100644 index 0000000000..22a0eb5c08 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/bridge/TokenVault.md @@ -0,0 +1,246 @@ +--- +title: TokenVault +--- + +## TokenVault + +This vault holds all ERC20 tokens (but not Ether) that users have deposited. +It also manages the mapping between canonical ERC20 tokens and their bridged +tokens. + +_Ether is held by Bridges on L1 and by the EtherVault on L2, not +TokenVaults._ + +### CanonicalERC20 + +```solidity +struct CanonicalERC20 { + uint256 chainId; + address addr; + uint8 decimals; + string symbol; + string name; +} +``` + +### MessageDeposit + +```solidity +struct MessageDeposit { + address token; + uint256 amount; +} +``` + +### isBridgedToken + +```solidity +mapping(address => bool) isBridgedToken +``` + +### bridgedToCanonical + +```solidity +mapping(address => struct TokenVault.CanonicalERC20) bridgedToCanonical +``` + +### canonicalToBridged + +```solidity +mapping(uint256 => mapping(address => address)) canonicalToBridged +``` + +### messageDeposits + +```solidity +mapping(bytes32 => struct TokenVault.MessageDeposit) messageDeposits +``` + +### BridgedERC20Deployed + +```solidity +event BridgedERC20Deployed(uint256 srcChainId, address canonicalToken, address bridgedToken, string canonicalTokenSymbol, string canonicalTokenName, uint8 canonicalTokenDecimal) +``` + +### EtherSent + +```solidity +event EtherSent(bytes32 msgHash, address from, address to, uint256 destChainId, uint256 amount) +``` + +### ERC20Sent + +```solidity +event ERC20Sent(bytes32 msgHash, address from, address to, uint256 destChainId, address token, uint256 amount) +``` + +### ERC20Released + +```solidity +event ERC20Released(bytes32 msgHash, address from, address token, uint256 amount) +``` + +### ERC20Received + +```solidity +event ERC20Received(bytes32 msgHash, address from, address to, uint256 srcChainId, address token, uint256 amount) +``` + +### TOKENVAULT_INVALID_TO + +```solidity +error TOKENVAULT_INVALID_TO() +``` + +Thrown when the `to` address in an operation is invalid. +This can happen if it's zero address or the address of the token vault. + +### TOKENVAULT_INVALID_VALUE + +```solidity +error TOKENVAULT_INVALID_VALUE() +``` + +Thrown when the value in a transaction is invalid. +The value can be an Ether amount or the amount of a token being +transferred. + +### TOKENVAULT_INVALID_TOKEN + +```solidity +error TOKENVAULT_INVALID_TOKEN() +``` + +Thrown when the token address in a transaction is invalid. +This could happen if the token address is zero or doesn't conform to the +ERC20 standard. + +### TOKENVAULT_INVALID_AMOUNT + +```solidity +error TOKENVAULT_INVALID_AMOUNT() +``` + +Thrown when the amount in a transaction is invalid. +This could happen if the amount is zero or exceeds the sender's balance. + +### TOKENVAULT_CANONICAL_TOKEN_NOT_FOUND + +```solidity +error TOKENVAULT_CANONICAL_TOKEN_NOT_FOUND() +``` + +Thrown when a canonical token address could not be found for a bridged +token. +This could happen when trying to send a bridged token back to its +original chain. + +### TOKENVAULT_INVALID_OWNER + +```solidity +error TOKENVAULT_INVALID_OWNER() +``` + +Thrown when the owner address in a message is invalid. +This could happen if the owner address is zero or doesn't match the +expected owner. + +### TOKENVAULT_INVALID_SRC_CHAIN_ID + +```solidity +error TOKENVAULT_INVALID_SRC_CHAIN_ID() +``` + +Thrown when the source chain ID in a message is invalid. +This could happen if the source chain ID doesn't match the current +chain's ID. + +### TOKENVAULT_MESSAGE_NOT_FAILED + +```solidity +error TOKENVAULT_MESSAGE_NOT_FAILED() +``` + +Thrown when a message has not failed. +This could happen if trying to release a message deposit without proof of +failure. + +### TOKENVAULT_INVALID_SENDER + +```solidity +error TOKENVAULT_INVALID_SENDER() +``` + +Thrown when the sender in a message context is invalid. +This could happen if the sender isn't the expected token vault on the +source chain. + +### init + +```solidity +function init(address addressManager) external +``` + +### sendERC20 + +```solidity +function sendERC20(uint256 destChainId, address to, address token, uint256 amount, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) external payable +``` + +Transfers ERC20 tokens to this vault and sends a message to the +destination chain so the user can receive the same amount of tokens +by invoking the message call. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | -------------------------------------- | +| destChainId | uint256 | Chain ID of the destination chain | +| to | address | Address of the receiver | +| token | address | The address of the token to be sent. | +| amount | uint256 | The amount of token to be transferred. | +| gasLimit | uint256 | Gas limit for the transaction | +| processingFee | uint256 | Processing fee for the transaction | +| refundAddress | address | Address for refunds | +| memo | string | Any additional data or notes | + +### releaseERC20 + +```solidity +function releaseERC20(struct IBridge.Message message, bytes proof) external +``` + +Release deposited ERC20 back to the owner on the source TokenVault with +a proof that the message processing on the destination Bridge has failed. + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------- | ---------------------------------------------------------------------- | +| message | struct IBridge.Message | The message that corresponds to the ERC20 deposit on the source chain. | +| proof | bytes | The proof from the destination chain to show the message has failed. | + +### receiveERC20 + +```solidity +function receiveERC20(struct TokenVault.CanonicalERC20 canonicalToken, address from, address to, uint256 amount) external +``` + +This function can only be called by the bridge contract while +invoking a message call. See sendERC20, which sets the data to invoke +this function. + +#### Parameters + +| Name | Type | Description | +| -------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| canonicalToken | struct TokenVault.CanonicalERC20 | The canonical ERC20 token which may or may not live on this chain. If not, a BridgedERC20 contract will be deployed. | +| from | address | The source address. | +| to | address | The destination address. | +| amount | uint256 | The amount of tokens to be sent. 0 is a valid value. | + +--- + +## title: ProxiedTokenVault + +## ProxiedTokenVault diff --git a/packages/website/pages/docs/reference/contract-documentation/common/AddressManager.md b/packages/website/pages/docs/reference/contract-documentation/common/AddressManager.md new file mode 100644 index 0000000000..9f4d1f555c --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/common/AddressManager.md @@ -0,0 +1,113 @@ +--- +title: IAddressManager +--- + +## IAddressManager + +Interface to set and get an address for a name. + +### setAddress + +```solidity +function setAddress(uint256 domain, bytes32 name, address newAddress) external +``` + +Changes the address associated with a particular name. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------------------- | +| domain | uint256 | Uint256 domain to assiciate an address with. | +| name | bytes32 | Name to associate an address with. | +| newAddress | address | Address to associate with the name. | + +### getAddress + +```solidity +function getAddress(uint256 domain, bytes32 name) external view returns (address) +``` + +Retrieves the address associated with a given name. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------- | +| domain | uint256 | Class to retrieve an address for. | +| name | bytes32 | Name to retrieve an address for. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------------------------- | +| [0] | address | Address associated with the given name. | + +--- + +## title: AddressManager + +## AddressManager + +### AddressSet + +```solidity +event AddressSet(uint256 _domain, bytes32 _name, address _newAddress, address _oldAddress) +``` + +### EOAOwnerAddressNotAllowed + +```solidity +error EOAOwnerAddressNotAllowed() +``` + +### init + +```solidity +function init() external +``` + +_Initializer to be called after being deployed behind a proxy._ + +### setAddress + +```solidity +function setAddress(uint256 domain, bytes32 name, address newAddress) external virtual +``` + +Changes the address associated with a particular name. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------------------- | +| domain | uint256 | Uint256 domain to assiciate an address with. | +| name | bytes32 | Name to associate an address with. | +| newAddress | address | Address to associate with the name. | + +### getAddress + +```solidity +function getAddress(uint256 domain, bytes32 name) external view virtual returns (address addr) +``` + +Retrieves the address associated with a given name. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------- | +| domain | uint256 | Class to retrieve an address for. | +| name | bytes32 | Name to retrieve an address for. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------------------------- | +| addr | address | Address associated with the given name. | + +--- + +## title: ProxiedAddressManager + +## ProxiedAddressManager diff --git a/packages/website/pages/docs/reference/contract-documentation/common/AddressResolver.md b/packages/website/pages/docs/reference/contract-documentation/common/AddressResolver.md new file mode 100644 index 0000000000..169e6f93ab --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/common/AddressResolver.md @@ -0,0 +1,111 @@ +--- +title: AddressResolver +--- + +## AddressResolver + +This abstract contract provides a name-to-address lookup. Under the hood, +it uses an AddressManager to manage the name-to-address mapping. + +### \_addressManager + +```solidity +contract IAddressManager _addressManager +``` + +### AddressManagerChanged + +```solidity +event AddressManagerChanged(address addressManager) +``` + +### RESOLVER_DENIED + +```solidity +error RESOLVER_DENIED() +``` + +### RESOLVER_INVALID_ADDR + +```solidity +error RESOLVER_INVALID_ADDR() +``` + +### RESOLVER_ZERO_ADDR + +```solidity +error RESOLVER_ZERO_ADDR(uint256 chainId, bytes32 name) +``` + +### onlyFromNamed + +```solidity +modifier onlyFromNamed(bytes32 name) +``` + +### resolve + +```solidity +function resolve(bytes32 name, bool allowZeroAddress) public view virtual returns (address payable) +``` + +Resolves a name to an address on the current chain. + +_This function will throw if the resolved address is `address(0)`._ + +#### Parameters + +| Name | Type | Description | +| ---------------- | ------- | ------------------------------------------ | +| name | bytes32 | The name to resolve. | +| allowZeroAddress | bool | True to allow zero address to be returned. | + +#### Return Values + +| Name | Type | Description | +| ---- | --------------- | --------------------------------- | +| [0] | address payable | The name's corresponding address. | + +### resolve + +```solidity +function resolve(uint256 chainId, bytes32 name, bool allowZeroAddress) public view virtual returns (address payable) +``` + +Resolves a name to an address on the specified chain. + +_This function will throw if the resolved address is `address(0)`._ + +#### Parameters + +| Name | Type | Description | +| ---------------- | ------- | ------------------------------------------ | +| chainId | uint256 | The chainId. | +| name | bytes32 | The name to resolve. | +| allowZeroAddress | bool | True to allow zero address to be returned. | + +#### Return Values + +| Name | Type | Description | +| ---- | --------------- | --------------------------------- | +| [0] | address payable | The name's corresponding address. | + +### addressManager + +```solidity +function addressManager() public view returns (address) +``` + +Returns the AddressManager's address. + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ----------------------------- | +| [0] | address | The AddressManager's address. | + +### \_init + +```solidity +function _init(address addressManager_) internal virtual +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/common/ICrossChainSync.md b/packages/website/pages/docs/reference/contract-documentation/common/ICrossChainSync.md new file mode 100644 index 0000000000..b1c8ee28a1 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/common/ICrossChainSync.md @@ -0,0 +1,55 @@ +--- +title: ICrossChainSync +--- + +## ICrossChainSync + +Interface implemented by both the TaikoL1 and TaikoL2 contracts. It exposes +the methods needed to access the block hashes of the other chain. + +### CrossChainSynced + +```solidity +event CrossChainSynced(uint256 srcHeight, bytes32 blockHash, bytes32 signalRoot) +``` + +### getCrossChainBlockHash + +```solidity +function getCrossChainBlockHash(uint256 number) external view returns (bytes32) +``` + +Returns the cross-chain block hash at the given block number. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------- | +| number | uint256 | The block number. Use 0 for the latest block. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------------- | +| [0] | bytes32 | The cross-chain block hash. | + +### getCrossChainSignalRoot + +```solidity +function getCrossChainSignalRoot(uint256 number) external view returns (bytes32) +``` + +Returns the cross-chain signal service storage root at the given +block number. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------- | +| number | uint256 | The block number. Use 0 for the latest block. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------------- | +| [0] | bytes32 | The cross-chain signal service storage root. | diff --git a/packages/website/pages/docs/reference/contract-documentation/common/IMintableERC20.md b/packages/website/pages/docs/reference/contract-documentation/common/IMintableERC20.md new file mode 100644 index 0000000000..0c9d4cf636 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/common/IMintableERC20.md @@ -0,0 +1,17 @@ +--- +title: IMintableERC20 +--- + +## IMintableERC20 + +### mint + +```solidity +function mint(address account, uint256 amount) external +``` + +### burn + +```solidity +function burn(address account, uint256 amount) external +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/common/Proxied.md b/packages/website/pages/docs/reference/contract-documentation/common/Proxied.md new file mode 100644 index 0000000000..a3bdc134b3 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/common/Proxied.md @@ -0,0 +1,11 @@ +--- +title: Proxied +--- + +## Proxied + +### constructor + +```solidity +constructor() internal +``` diff --git a/packages/website/pages/docs/reference/contract-documentation/gov/TaikoGovernor.md b/packages/website/pages/docs/reference/contract-documentation/gov/TaikoGovernor.md new file mode 100644 index 0000000000..06df08d5a6 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/gov/TaikoGovernor.md @@ -0,0 +1,77 @@ +--- +title: TaikoGovernor +--- + +## TaikoGovernor + +### init + +```solidity +function init(address _addressManager, contract IVotesUpgradeable _token, contract TimelockControllerUpgradeable _timelock) public +``` + +### propose + +```solidity +function propose(address[] targets, uint256[] values, bytes[] calldatas, string description) public returns (uint256) +``` + +### votingDelay + +```solidity +function votingDelay() public view returns (uint256) +``` + +### votingPeriod + +```solidity +function votingPeriod() public view returns (uint256) +``` + +### quorum + +```solidity +function quorum(uint256 blockNumber) public view returns (uint256) +``` + +### state + +```solidity +function state(uint256 proposalId) public view returns (enum IGovernorUpgradeable.ProposalState) +``` + +### proposalThreshold + +```solidity +function proposalThreshold() public view returns (uint256) +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) public view returns (bool) +``` + +### \_execute + +```solidity +function _execute(uint256 proposalId, address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) internal +``` + +### \_cancel + +```solidity +function _cancel(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) internal returns (uint256) +``` + +### \_executor + +```solidity +function _executor() internal view returns (address) +``` + +--- + +## title: ProxiedTaikoGovernor + +## ProxiedTaikoGovernor diff --git a/packages/website/pages/docs/reference/contract-documentation/signal/ISignalService.md b/packages/website/pages/docs/reference/contract-documentation/signal/ISignalService.md new file mode 100644 index 0000000000..3f342e78a4 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/signal/ISignalService.md @@ -0,0 +1,57 @@ +--- +title: ISignalService +--- + +## ISignalService + +### sendSignal + +```solidity +function sendSignal(bytes32 signal) external returns (bytes32 storageSlot) +``` + +Send a signal by storing the key with a value of 1. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------- | +| signal | bytes32 | The signal to send. | + +#### Return Values + +| Name | Type | Description | +| ----------- | ------- | -------------------------------------------------- | +| storageSlot | bytes32 | The slot in storage that this signal is persisted. | + +### isSignalSent + +```solidity +function isSignalSent(address app, bytes32 signal) external view returns (bool) +``` + +Check if a signal has been sent (key stored with a value of 1). + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------------- | +| app | address | The address that sent this message. | +| signal | bytes32 | The signal to check. | + +### isSignalReceived + +```solidity +function isSignalReceived(uint256 srcChainId, address app, bytes32 signal, bytes proof) external view returns (bool) +``` + +Check if signal has been received on the destination chain (current). + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| srcChainId | uint256 | The source chain ID. | +| app | address | The address that sent this message. | +| signal | bytes32 | The signal to check. | +| proof | bytes | The proof of the signal being sent on the source chain. | diff --git a/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md b/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md new file mode 100644 index 0000000000..5b70469788 --- /dev/null +++ b/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md @@ -0,0 +1,117 @@ +--- +title: SignalService +--- + +## SignalService + +### SignalProof + +```solidity +struct SignalProof { + uint256 height; + bytes proof; +} +``` + +### B_ZERO_SIGNAL + +```solidity +error B_ZERO_SIGNAL() +``` + +### B_NULL_APP_ADDR + +```solidity +error B_NULL_APP_ADDR() +``` + +### B_WRONG_CHAIN_ID + +```solidity +error B_WRONG_CHAIN_ID() +``` + +### init + +```solidity +function init(address _addressManager) external +``` + +_Initializer to be called after being deployed behind a proxy._ + +### sendSignal + +```solidity +function sendSignal(bytes32 signal) public returns (bytes32 storageSlot) +``` + +Send a signal by storing the key with a value of 1. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------- | +| signal | bytes32 | The signal to send. | + +#### Return Values + +| Name | Type | Description | +| ----------- | ------- | -------------------------------------------------- | +| storageSlot | bytes32 | The slot in storage that this signal is persisted. | + +### isSignalSent + +```solidity +function isSignalSent(address app, bytes32 signal) public view returns (bool) +``` + +Check if a signal has been sent (key stored with a value of 1). + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------------- | +| app | address | The address that sent this message. | +| signal | bytes32 | The signal to check. | + +### isSignalReceived + +```solidity +function isSignalReceived(uint256 srcChainId, address app, bytes32 signal, bytes proof) public view returns (bool) +``` + +Check if signal has been received on the destination chain (current). + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| srcChainId | uint256 | The source chain ID. | +| app | address | The address that sent this message. | +| signal | bytes32 | The signal to check. | +| proof | bytes | The proof of the signal being sent on the source chain. | + +### getSignalSlot + +```solidity +function getSignalSlot(address app, bytes32 signal) public pure returns (bytes32 signalSlot) +``` + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------------------------- | +| app | address | The srcAddress of the app (eg. the Bridge). | +| signal | bytes32 | The signal to store. | + +#### Return Values + +| Name | Type | Description | +| ---------- | ------- | ----------------------------------------------------- | +| signalSlot | bytes32 | The storage key for the signal on the signal service. | + +--- + +## title: ProxiedSignalService + +## ProxiedSignalService diff --git a/packages/website/public/images/diagrams/concepts/eip-1559/fee-layout.png b/packages/website/public/images/diagrams/concepts/eip-1559/fee-layout.png new file mode 100644 index 0000000000..f6dcd511a2 Binary files /dev/null and b/packages/website/public/images/diagrams/concepts/eip-1559/fee-layout.png differ