mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-23 10:48:00 +00:00
Constructors and contract creation (#11)
Implement constructor logic and support create/create2 in the mock runtime Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
pub mod default_call;
|
||||
pub mod deploy_code;
|
||||
pub mod deployer_call;
|
||||
pub mod entry;
|
||||
pub mod runtime_code;
|
||||
|
||||
@@ -13,14 +12,13 @@ use crate::polkavm::Dependency;
|
||||
use crate::polkavm::WriteLLVM;
|
||||
|
||||
use self::default_call::DefaultCall;
|
||||
use self::deployer_call::DeployerCall;
|
||||
|
||||
/// The front-end runtime functions.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Runtime {
|
||||
/// The address space where the calldata is allocated.
|
||||
/// Solidity uses the ordinary heap. Vyper uses the auxiliary heap.
|
||||
address_space: AddressSpace,
|
||||
_address_space: AddressSpace,
|
||||
}
|
||||
|
||||
impl Runtime {
|
||||
@@ -34,8 +32,8 @@ impl Runtime {
|
||||
pub const FUNCTION_RUNTIME_CODE: &'static str = "__runtime";
|
||||
|
||||
/// A shortcut constructor.
|
||||
pub fn new(address_space: AddressSpace) -> Self {
|
||||
Self { address_space }
|
||||
pub fn new(_address_space: AddressSpace) -> Self {
|
||||
Self { _address_space }
|
||||
}
|
||||
|
||||
/// Returns the corresponding runtime function.
|
||||
@@ -52,18 +50,6 @@ impl Runtime {
|
||||
.borrow()
|
||||
.declaration()
|
||||
}
|
||||
|
||||
/// Returns the corresponding runtime function.
|
||||
pub fn deployer_call<'ctx, D>(context: &Context<'ctx, D>) -> FunctionDeclaration<'ctx>
|
||||
where
|
||||
D: Dependency + Clone,
|
||||
{
|
||||
context
|
||||
.get_function(DeployerCall::FUNCTION_NAME)
|
||||
.expect("Always exists")
|
||||
.borrow()
|
||||
.declaration()
|
||||
}
|
||||
}
|
||||
|
||||
impl<D> WriteLLVM<D> for Runtime
|
||||
@@ -74,7 +60,6 @@ where
|
||||
//DefaultCall::new(context.llvm_runtime().far_call).declare(context)?;
|
||||
DefaultCall::new(context.llvm_runtime().static_call).declare(context)?;
|
||||
DefaultCall::new(context.llvm_runtime().delegate_call).declare(context)?;
|
||||
DeployerCall::new(self.address_space).declare(context)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -83,7 +68,6 @@ where
|
||||
//DefaultCall::new(context.llvm_runtime().far_call).into_llvm(context)?;
|
||||
DefaultCall::new(context.llvm_runtime().static_call).into_llvm(context)?;
|
||||
DefaultCall::new(context.llvm_runtime().delegate_call).into_llvm(context)?;
|
||||
DeployerCall::new(self.address_space).into_llvm(context)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user