evm: interfaces
This commit is contained in:
parent
afb35eab5c
commit
966123223e
|
@ -1 +1,48 @@
|
||||||
# Core Layer
|
# Core Layer
|
||||||
|
|
||||||
|
This is the interface for applications to interact with Wormhole's Core Contract to publish messages or verify and parse a received message.
|
||||||
|
|
||||||
|
```
|
||||||
|
// contracts/Messages.sol
|
||||||
|
// SPDX-License-Identifier: Apache 2
|
||||||
|
|
||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "../Structs.sol";
|
||||||
|
|
||||||
|
interface IWormhole is Structs {
|
||||||
|
event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel);
|
||||||
|
|
||||||
|
function publishMessage(
|
||||||
|
uint32 nonce,
|
||||||
|
bytes memory payload,
|
||||||
|
uint8 consistencyLevel
|
||||||
|
) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
function parseAndVerifyVM(bytes calldata encodedVM) external view returns (Structs.VM memory vm, bool valid, string memory reason);
|
||||||
|
|
||||||
|
function verifyVM(Structs.VM memory vm) external view returns (bool valid, string memory reason);
|
||||||
|
|
||||||
|
function verifySignatures(bytes32 hash, Structs.Signature[] memory signatures, Structs.GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason) ;
|
||||||
|
|
||||||
|
function parseVM(bytes memory encodedVM) external pure returns (Structs.VM memory vm);
|
||||||
|
|
||||||
|
function getGuardianSet(uint32 index) external view returns (Structs.GuardianSet memory) ;
|
||||||
|
|
||||||
|
function getCurrentGuardianSetIndex() external view returns (uint32) ;
|
||||||
|
|
||||||
|
function getGuardianSetExpiry() external view returns (uint32) ;
|
||||||
|
|
||||||
|
function governanceActionIsConsumed(bytes32 hash) external view returns (bool) ;
|
||||||
|
|
||||||
|
function isInitialized(address impl) external view returns (bool) ;
|
||||||
|
|
||||||
|
function chainId() external view returns (uint16) ;
|
||||||
|
|
||||||
|
function governanceChainId() external view returns (uint16);
|
||||||
|
|
||||||
|
function governanceContract() external view returns (bytes32);
|
||||||
|
|
||||||
|
function messageFee() external view returns (uint256) ;
|
||||||
|
}
|
||||||
|
```
|
|
@ -1 +1,27 @@
|
||||||
# NFT Layer
|
# NFT Layer
|
||||||
|
|
||||||
|
This is the interface for applications to interact with Wormhole's NFT Bridge Contract to publish messages or verify and parse a received message.
|
||||||
|
|
||||||
|
```
|
||||||
|
// contracts/NFTBridge.sol
|
||||||
|
// SPDX-License-Identifier: Apache 2
|
||||||
|
|
||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "./NFTBridgeGetters.sol";
|
||||||
|
|
||||||
|
interface INFTBridge is NFTGetters {
|
||||||
|
|
||||||
|
function transferNFT(address token, uint256 tokenID, uint16 recipientChain, bytes32 recipient, uint32 nonce) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
function completeTransfer(bytes memory encodeVm) external ;
|
||||||
|
|
||||||
|
function encodeTransfer(NFTBridgeStructs.Transfer memory transfer) external pure returns (bytes memory encoded);
|
||||||
|
|
||||||
|
function parseTransfer(bytes memory encoded) external pure returns (NFTBridgeStructs.Transfer memory transfer);
|
||||||
|
|
||||||
|
function onERC721Received(address operator, address, uint256, bytes calldata) external view returns (bytes4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
|
@ -1 +1,127 @@
|
||||||
# xAsset Layer
|
# xAsset Layer
|
||||||
|
|
||||||
|
This is the interface for applications to interact with Wormhole's Token Bridge Contract to publish messages or verify and parse a received message.
|
||||||
|
|
||||||
|
```
|
||||||
|
// contracts/Bridge.sol
|
||||||
|
// SPDX-License-Identifier: Apache 2
|
||||||
|
|
||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "./BridgeGetters.sol";
|
||||||
|
|
||||||
|
interface ITokenBridge is BridgeGetters {
|
||||||
|
/*
|
||||||
|
* @dev Produce a AssetMeta message for a given token
|
||||||
|
*/
|
||||||
|
function attestToken(address tokenAddress, uint32 nonce) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Send eth through portal by first wrapping it to WETH.
|
||||||
|
*/
|
||||||
|
function wrapAndTransferETH(
|
||||||
|
uint16 recipientChain,
|
||||||
|
bytes32 recipient,
|
||||||
|
uint256 arbiterFee,
|
||||||
|
uint32 nonce
|
||||||
|
) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Send eth through portal by first wrapping it.
|
||||||
|
*
|
||||||
|
* @dev This type of transfer is called a "contract-controlled transfer".
|
||||||
|
* There are three differences from a regular token transfer:
|
||||||
|
* 1) Additional arbitrary payload can be attached to the message
|
||||||
|
* 2) Only the recipient (typically a contract) can redeem the transaction
|
||||||
|
* 3) The sender's address (msg.sender) is also included in the transaction payload
|
||||||
|
*
|
||||||
|
* With these three additional components, xDapps can implement cross-chain
|
||||||
|
* composable interactions.
|
||||||
|
*/
|
||||||
|
function wrapAndTransferETHWithPayload(
|
||||||
|
uint16 recipientChain,
|
||||||
|
bytes32 recipient,
|
||||||
|
uint32 nonce,
|
||||||
|
bytes memory payload
|
||||||
|
) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Send ERC20 token through portal.
|
||||||
|
*/
|
||||||
|
function transferTokens(
|
||||||
|
address token,
|
||||||
|
uint256 amount,
|
||||||
|
uint16 recipientChain,
|
||||||
|
bytes32 recipient,
|
||||||
|
uint256 arbiterFee,
|
||||||
|
uint32 nonce
|
||||||
|
) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Send ERC20 token through portal.
|
||||||
|
*
|
||||||
|
* @dev This type of transfer is called a "contract-controlled transfer".
|
||||||
|
* There are three differences from a regular token transfer:
|
||||||
|
* 1) Additional arbitrary payload can be attached to the message
|
||||||
|
* 2) Only the recipient (typically a contract) can redeem the transaction
|
||||||
|
* 3) The sender's address (msg.sender) is also included in the transaction payload
|
||||||
|
*
|
||||||
|
* With these three additional components, xDapps can implement cross-chain
|
||||||
|
* composable interactions.
|
||||||
|
*/
|
||||||
|
function transferTokensWithPayload(
|
||||||
|
address token,
|
||||||
|
uint256 amount,
|
||||||
|
uint16 recipientChain,
|
||||||
|
bytes32 recipient,
|
||||||
|
uint32 nonce,
|
||||||
|
bytes memory payload
|
||||||
|
) external payable returns (uint64 sequence);
|
||||||
|
|
||||||
|
function updateWrapped(bytes memory encodedVm) external returns (address token);
|
||||||
|
|
||||||
|
function createWrapped(bytes memory encodedVm) external returns (address token);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Complete a contract-controlled transfer of an ERC20 token.
|
||||||
|
*
|
||||||
|
* @dev The transaction can only be redeemed by the recipient, typically a
|
||||||
|
* contract.
|
||||||
|
*
|
||||||
|
* @param encodedVm A byte array containing a VAA signed by the guardians.
|
||||||
|
*
|
||||||
|
* @return The byte array representing a BridgeStructs.TransferWithPayload.
|
||||||
|
*/
|
||||||
|
function completeTransferWithPayload(bytes memory encodedVm) external returns (bytes memory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Complete a contract-controlled transfer of WETH, and unwrap to ETH.
|
||||||
|
*
|
||||||
|
* @dev The transaction can only be redeemed by the recipient, typically a
|
||||||
|
* contract.
|
||||||
|
*
|
||||||
|
* @param encodedVm A byte array containing a VAA signed by the guardians.
|
||||||
|
*
|
||||||
|
* @return The byte array representing a BridgeStructs.TransferWithPayload.
|
||||||
|
*/
|
||||||
|
function completeTransferAndUnwrapETHWithPayload(bytes memory encodedVm) external returns (bytes memory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Complete a transfer of an ERC20 token.
|
||||||
|
*
|
||||||
|
* @dev The msg.sender gets paid the associated fee.
|
||||||
|
*
|
||||||
|
* @param encodedVm A byte array containing a VAA signed by the guardians.
|
||||||
|
*/
|
||||||
|
function completeTransfer(bytes memory encodedVm) external ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @notice Complete a transfer of WETH and unwrap to eth.
|
||||||
|
*
|
||||||
|
* @dev The msg.sender gets paid the associated fee.
|
||||||
|
*
|
||||||
|
* @param encodedVm A byte array containing a VAA signed by the guardians.
|
||||||
|
*/
|
||||||
|
function completeTransferAndUnwrapETH(bytes memory encodedVm) external ;
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue