CrossSpaceCall Contract
Conflux eSpace and Core space are two separate space, you can not send CFX from base32 address to hex address directly. You can only use Confluxhub Space Bridge to cross CFX between eSpace and Core Space.
Under the hood there is a internal contract named CrossSpaceCall
in Core Space, which is used to transfer CFX between eSpace and Core Space. With CrossSpaceCall, it becomes feasible to directly engage with eSpace contracts from within Core Space. This contract is introduced by CIP-90.
CrossSpaceCall Interface
This contract is available on Core Space under the address:
- base32 address:
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaa2sn102vjv
- hex address(use in solidity):
0x0888000000000000000000000000000000000006
Below is the interface of this contract:
interface CrossSpaceCall {
/**
* @dev Deploy a contract in eSpace
* @param init bytes - The contract init bytecode
* @return bytes20 - The hex address of the deployed contract
*/
function createEVM(bytes calldata init) external payable returns (bytes20);
/* methods for cross-space CFX transfers */
/**
* @dev Transfer CFX from Core space to eSpace specify address. Transfer amount is specified by transaction value.
* @param to bytes20 - The hex address of the receiver address in eSpace
* @return output bytes
*/
function transferEVM(bytes20 to) external payable returns (bytes memory output);
/**
* @dev Widthdraw CFX from eSpace mapped account's balance
* @param value uint256 - The amount of CFX to be withdrawn
*/
function withdrawFromMapped(uint256 value) external;
/**
* @dev Query eSpace mapped account's CFX balance
* @param addr address - The core address to query
* @return uint256 - Balance
*/
function mappedBalance(address addr) external view returns (uint256);
/**
* @dev Query eSpace mapped account's nonce
* @param addr address - The core address to query
* @return uint256 - Balance
* */
function mappedNonce(address addr) external view returns (uint256);
/* methods for other cross-space operations */
/**
* @dev Call eSpace contract method from Core space
* @param to bytes20 - The hex address of the contract in eSpace
* @param data bytes - The contract method call data
* @return output bytes - Method call result
*/
function callEVM(bytes20 to, bytes calldata data) external payable returns (bytes memory output);
/**
* @dev Static call eSpace contract method from Core space
* @param to bytes20 - The hex address of the contract in eSpace
* @param data bytes - The contract method call data
* @return output bytes - Method call result
*/
function staticCallEVM(bytes20 to, bytes calldata data) external view returns (bytes memory output);
}
Transfer CFX between eSpace and Core Space
Cross CFX between eSpace and Core Space can be achieved through call CrossSpaceCall
internal contract's related methods.
Note that CrossSpaceCall
(like other internal contracts) can only be accessed in the Conflux Core space.