Skip to content

Commit

Permalink
Update types in CE & precompiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunxw committed Jul 29, 2023
1 parent e74b81a commit 02bfcb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chain-extensions/types/xvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#![cfg_attr(not(feature = "std"), no_std)]

use astar_primitives::xvm::CallError;
use astar_primitives::{xvm::CallError, Balance};
use parity_scale_codec::{Decode, Encode};
use sp_std::vec::Vec;

Expand Down Expand Up @@ -66,5 +66,5 @@ pub struct XvmCallArgs {
/// Encoded call params
pub input: Vec<u8>,
/// Value to transfer
pub value: u128,
pub value: Balance,
}
8 changes: 5 additions & 3 deletions precompiles/xvm/evm_sdk/XVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ pragma solidity ^0.8.0;
interface XVM {
/**
* @dev Execute external VM call
* @param context - execution context
* @param to - call recepient
* @param vm_id - target VM id
* @param to - call recipient
* @param input - SCALE-encoded call arguments
* @param value - value to transfer
* @return success - operation outcome
* @return data - output data if successful, error data on error
*/
function xvm_call(
bytes calldata context,
uint8 calldata vm_id,
bytes calldata to,
bytes calldata input
uint256 value
) external returns (bool success, bytes memory data);
}
3 changes: 2 additions & 1 deletion precompiles/xvm/evm_sdk/flipper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface XVM {
uint8 calldata vm_id,
bytes calldata to,
bytes calldata input,
uint256 calldata value,
) external;
}

Expand All @@ -13,6 +14,6 @@ library Flipper {

function flip(bytes to) {
bytes input = "0xcafecafe";
XVM_PRECOMPILE.xvm_call(0x1F, to, input);
XVM_PRECOMPILE.xvm_call(0x1F, to, input, 1000000);
}
}

0 comments on commit 02bfcb9

Please sign in to comment.