-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
449 additions
and
86 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
* @bbbeeeee @andresaiello @fadeev @brewmaster012 | ||
* @bbbeeeee @fadeev @brewmaster012 @zeta-chain/fullstack | ||
|
||
/src/pages/nodes/ @zeta-chain/DevOps @fadeev | ||
/src/pages/nodes/ @zeta-chain/DevOps @fadeev |
26 changes: 26 additions & 0 deletions
26
src/components/shared/components/Icons/components/IconSpeechBubble.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import clsx from "clsx"; | ||
import { SVGProps } from "react"; | ||
|
||
const IconSpeechBubble = <T extends unknown>({ | ||
color, | ||
...otherProps | ||
}: SVGProps<T, SVGSVGElement> & { color?: string }) => ( | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...otherProps} | ||
className={clsx(otherProps?.className, { "text-grey-400 dark:text-grey-300": !otherProps?.className })} | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M2.75 4C2.75 3.58579 3.08579 3.25 3.5 3.25H19.5C21.0188 3.25 22.25 4.48122 22.25 6V16C22.25 16.4142 21.9142 16.75 21.5 16.75H14.8107L10.0303 21.5303C9.81583 21.7448 9.49324 21.809 9.21299 21.6929C8.93273 21.5768 8.75 21.3033 8.75 21V16.75H3.5C3.08579 16.75 2.75 16.4142 2.75 16V4ZM4.25 4.75V15.25H9.5C9.91421 15.25 10.25 15.5858 10.25 16V19.1893L13.9697 15.4697C14.1103 15.329 14.3011 15.25 14.5 15.25H20.75V6C20.75 5.30964 20.1904 4.75 19.5 4.75H4.25ZM7.75 10C7.75 9.58579 8.08579 9.25 8.5 9.25H8.51C8.92421 9.25 9.26 9.58579 9.26 10C9.26 10.4142 8.92421 10.75 8.51 10.75H8.5C8.08579 10.75 7.75 10.4142 7.75 10ZM11.75 10C11.75 9.58579 12.0858 9.25 12.5 9.25H12.51C12.9242 9.25 13.26 9.58579 13.26 10C13.26 10.4142 12.9242 10.75 12.51 10.75H12.5C12.0858 10.75 11.75 10.4142 11.75 10ZM15.75 10C15.75 9.58579 16.0858 9.25 16.5 9.25H16.51C16.9242 9.25 17.26 9.58579 17.26 10C17.26 10.4142 16.9242 10.75 16.51 10.75H16.5C16.0858 10.75 15.75 10.4142 15.75 10Z" | ||
fill={color || "currentColor"} | ||
/> | ||
</svg> | ||
); | ||
|
||
export { IconSpeechBubble }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"intro": { | ||
"title": "Universal App Basics", | ||
"description": "What is a universal app and what makes it different" | ||
"description": "Build universal apps that can be called from any blockchain" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"zetachain": { | ||
"title": "ZetaChain", | ||
"description": "Make calls from universal apps and withdraw tokens to connected chains" | ||
}, | ||
"evm": { | ||
"title": "EVM Blockchains", | ||
"description": "Make calls to universal apps and deposit tokens from Ethereum, BNB, Polygon, Base and more" | ||
}, | ||
"solana": { | ||
"title": "Solana", | ||
"description": "Make calls to universal apps and deposit SOL from Solana" | ||
}, | ||
"bitcoin": { | ||
"title": "Bitcoin", | ||
"description": "Make calls to universal apps and deposit BTC from Bitcoin" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
To interact with universal apps from EVM chains (like Ethereum, BNB, Polygon, | ||
etc.) use the EVM gateway. | ||
|
||
EVM gateway supports: | ||
|
||
- depositing gas tokens to a universal app or an account on ZetaChain | ||
- depositing supported ERC-20 tokens (including ZETA tokens) | ||
- depositing gas tokens and calling a universal app | ||
- depositing supported ERC-20 tokens and calling a universal app | ||
- calling a universal app | ||
|
||
## Deposit Gas Tokens | ||
|
||
To deposit tokens to an EOA or a universal contract call the `deposit` function | ||
of the Gateway contract. | ||
|
||
```solidity | ||
deposit(address receiver, RevertOptions calldata revertOptions) external payable; | ||
``` | ||
|
||
The `deposit` function is payable, which means it accepts native gas tokens (for | ||
example, ETH on Ethereum), which will then be sent to a `receiver` on ZetaChain. | ||
|
||
The `receiver` is either an externally-owned account (EOA) or a universal app | ||
address on ZetaChain. Even if the receiver is a universal app contract with the | ||
standard `receive` function, the `deposit` function will not trigger a contract | ||
call. If you want to deposit and call a universal app, please, use the | ||
`depositAndCall` function, instead. | ||
|
||
After the deposit is processed, the receiver gets [ZRC-20 | ||
version](/developers/tokens/zrc20) of the deposited token, for example (ZRC-20 | ||
ETH). | ||
|
||
## Deposit ERC-20 Tokens | ||
|
||
The `deposit` function can also be used to send supported ERC-20 tokens to EOAs | ||
and universal apps on ZetaChain. | ||
|
||
```solidity | ||
deposit(address receiver, uint256 amount, address asset, RevertOptions calldata revertOptions) external; | ||
``` | ||
|
||
Only [supported ERC-20 assets](/developers/tokens/zrc20) can be deposited. The | ||
receiver gets ZRC-20 version of the deposited token (for example, ZRC-20 | ||
USDC.ETH). | ||
|
||
The `amount` is the amount and `asset` is the token address of the ERC-20 that | ||
is being deposited. | ||
|
||
## Deposit Gas Tokens and Call a Universal App | ||
|
||
To deposit tokens and call a universal app contract use the `depositAndCall` | ||
function. | ||
|
||
```solidity | ||
depositAndCall(address receiver, bytes calldata payload, RevertOptions calldata revertOptions) external payable; | ||
``` | ||
|
||
After the cross-chain transaction is processed, the `onCrossChainCall` function | ||
of a universal app contract is executed. | ||
|
||
The `receiver` must be a universal app contract address. | ||
|
||
```solidity | ||
pragma solidity 0.8.7; | ||
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol"; | ||
contract UniversalApp is UniversalContract { | ||
function onCrossChainCall( | ||
zContext calldata context, | ||
address zrc20, | ||
uint256 amount, | ||
bytes calldata message | ||
) external virtual override { | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
`onCrossChainCall` receives: | ||
|
||
- `message`: value of the `payload` | ||
- `amount`: amount of deposited tokens | ||
- `zrc20`: ZRC-20 address of a the deposited tokens (for example, contract | ||
address of ZRC-20 ETH) | ||
- `context`: | ||
- `context.origin`: the original sender address on a connected chain (the EOA | ||
or contract that called the Gateway) | ||
- `context.chainID`: chain ID of the connected chain from which the call was | ||
made | ||
|
||
When calling a universal app, the payload contains bytes passed to | ||
`onCrossChainCall` as `message`. You don't need to pass a function selector in | ||
the payload as the only function that can be called from a connected chain is | ||
`onCrossChainCall`. | ||
|
||
## Deposit ERC-20 Tokens and Call a Universal App | ||
|
||
`depositAndCall` can also be used to call a universal app contract and send | ||
ERC-20 tokens. | ||
|
||
```solidity | ||
depositAndCall(address receiver, uint256 amount, address asset, bytes calldata payload, RevertOptions calldata revertOptions) external; | ||
``` | ||
|
||
The `amount` is the amount and `asset` is the token address of the ERC-20 that | ||
is being deposited. | ||
|
||
In the current version of the protocol only one ERC-20 asset can be deposited at | ||
a time. | ||
|
||
## Call a Universal App | ||
|
||
To call a universal app (without depositing tokens), use the `call` function. | ||
|
||
```solidity | ||
call(address receiver, bytes calldata payload, RevertOptions calldata revertOptions) external; | ||
``` | ||
|
||
## Revert Transactions | ||
|
||
For information on `RevertOptions` refer to the [ZetaChain "Revert Transactions" | ||
doc](/developers/chains/zetachain#revert-transactions). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
On Solana the gateway is implemented as a Solana program. | ||
|
||
Solana gateway supports: | ||
|
||
- depositing SOL to a universal app or an account on ZetaChain | ||
- depositing SOL and calling a universal app | ||
- depositing SPL tokens (coming soon) | ||
|
||
https://github.com/zeta-chain/protocol-contracts-solana/ |
Oops, something went wrong.