mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 08:11:02 +00:00
@@ -6,10 +6,13 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
hex = { workspace = true }
|
||||
polkavm = { workspace = true }
|
||||
alloy-primitives = { workspace = true }
|
||||
parity-scale-codec = { workspace = true }
|
||||
revive-solidity = { path = "../solidity" }
|
||||
era-compiler-llvm-context = { path = "../llvm-context" }
|
||||
alloy-primitives = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-sol-types = { workspace = true }
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.24;
|
||||
|
||||
contract Computation {
|
||||
function triangle_number(int64 n) public pure returns (int64 sum) {
|
||||
unchecked {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.24;
|
||||
|
||||
contract Flipper {
|
||||
bool coin;
|
||||
|
||||
|
||||
@@ -217,9 +217,21 @@ pub fn call(mut state: State, on: &InstancePre<State>, export: ExportIndex) -> S
|
||||
|
||||
let call_args = polkavm::CallArgs::new(&mut state, export);
|
||||
|
||||
init_logs();
|
||||
|
||||
match on.instantiate().unwrap().call(state_args, call_args) {
|
||||
Err(polkavm::ExecutionError::Trap(_)) => state,
|
||||
Err(other) => panic!("unexpected error: {other}"),
|
||||
Ok(_) => panic!("unexpected return"),
|
||||
}
|
||||
}
|
||||
|
||||
fn init_logs() {
|
||||
if std::env::var("RUST_LOG").is_ok() {
|
||||
#[cfg(test)]
|
||||
let test = true;
|
||||
#[cfg(not(test))]
|
||||
let test = false;
|
||||
let _ = env_logger::builder().is_test(test).try_init();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user