Implement MCOPY (#18)

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
Cyrill Leutwiler
2024-05-29 21:43:22 +02:00
committed by GitHub
parent 2ea10d0c3e
commit 532721f3be
11 changed files with 81 additions and 122 deletions
+18
View File
@@ -129,6 +129,12 @@ sol!(
}
);
sol!(
contract MCopy {
function memcpy(bytes memory payload) public pure returns (bytes memory);
}
);
impl Contract {
/// Execute the contract.
///
@@ -423,6 +429,18 @@ impl Contract {
calldata: ExtCode::ExtCodeSizeCall::new((address,)).abi_encode(),
}
}
pub fn memcpy(payload: Vec<u8>) -> Self {
let code = include_str!("../contracts/MCopy.sol");
let name = "MCopy";
Self {
name,
evm_runtime: crate::compile_evm_bin_runtime(name, code),
pvm_runtime: crate::compile_blob(name, code),
calldata: MCopy::memcpyCall::new((payload,)).abi_encode(),
}
}
}
#[cfg(test)]