Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
sidenaio committed Feb 17, 2023
1 parent 2716376 commit a37819c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 53 deletions.
5 changes: 0 additions & 5 deletions bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,18 @@ typedef struct GoApi_vtable {
int32_t (*remove_storage)(const struct api_t*, struct U8SliceView, uint64_t*);
int32_t (*block_number)(const struct api_t*, uint64_t*, uint64_t*);
int32_t (*block_timestamp)(const struct api_t*, uint64_t*, int64_t*);
int32_t (*send)(const struct api_t*, struct U8SliceView, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*min_fee_per_gas)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*balance)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*block_seed)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*network_size)(const struct api_t*, uint64_t*, uint64_t*);
int32_t (*burn)(const struct api_t*, struct U8SliceView, uint64_t*);
int32_t (*epoch)(const struct api_t*, uint64_t*, uint16_t*);
int32_t (*contract_stake)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*move_to_stake)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*delegatee)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*identity)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*caller)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*original_caller)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*deduct_balance)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*add_balance)(const struct api_t*, struct U8SliceView, struct U8SliceView, uint64_t*);
int32_t (*contract)(const struct api_t*, uint64_t*, struct UnmanagedVector*);
int32_t (*contract_code)(const struct api_t*, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
int32_t (*call)(const struct api_t*, struct U8SliceView, struct U8SliceView, struct U8SliceView, struct U8SliceView, struct U8SliceView, uint64_t, uint64_t*, struct UnmanagedVector*);
int32_t (*deploy)(const struct api_t*, struct U8SliceView, struct U8SliceView, struct U8SliceView, struct U8SliceView, uint64_t, uint64_t*, struct UnmanagedVector*);
int32_t (*contract_addr)(const struct api_t*, struct U8SliceView, struct U8SliceView, struct U8SliceView, uint64_t*, struct UnmanagedVector*);
Expand Down
5 changes: 0 additions & 5 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub trait Backend: Copy + Clone + Send {
fn deduct_balance(&self, amount: IDNA) -> BackendResult<()>;
fn add_balance(&self, to: Address, amount: IDNA) ->u64;
fn own_addr(&self) -> BackendResult<Address>;
fn contract_code(&self, contract: Address) -> BackendResult<Vec<u8>>;
fn contract_addr(&self, code: &[u8], args: &[u8], nonce: &[u8]) -> BackendResult<Address>;
fn deploy(&self, code : &[u8], args: &[u8], nonce: &[u8], amount: &[u8], gas_limit: u64) -> BackendResult<ActionResult>;
fn contract_addr_by_hash(&self, hash: &[u8], args: &[u8], nonce: &[u8]) -> BackendResult<Address>;
Expand Down Expand Up @@ -162,10 +161,6 @@ impl Backend for MockBackend {
todo!()
}

fn contract_code(&self, contract: Address) -> BackendResult<Vec<u8>> {
todo!()
}

fn contract_addr(&self, code: &[u8], args: &[u8], nonce: &[u8]) -> BackendResult<Address> {
todo!()
}
Expand Down
43 changes: 0 additions & 43 deletions src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ pub struct GoApi_vtable {
*mut u64,
*mut i64, // result output
) -> i32,
pub send: extern "C" fn(
*const api_t,
U8SliceView, // to
U8SliceView, // amount
*mut u64,
*mut UnmanagedVector, // error
) -> i32,
pub min_fee_per_gas: extern "C" fn(
*const api_t,
*mut u64,
Expand Down Expand Up @@ -91,24 +84,6 @@ pub struct GoApi_vtable {
*mut u64,
*mut u16,
) -> i32,
pub contract_stake: extern "C" fn(
*const api_t,
U8SliceView, // addr
*mut u64,
*mut UnmanagedVector, // result
) -> i32,
pub move_to_stake: extern "C" fn(
*const api_t,
U8SliceView, // amount
*mut u64,
*mut UnmanagedVector, // output error
) -> i32,
pub delegatee: extern "C" fn(
*const api_t,
U8SliceView, // addr
*mut u64,
*mut UnmanagedVector, // result
) -> i32,
pub identity: extern "C" fn(
*const api_t,
U8SliceView, // addr
Expand Down Expand Up @@ -142,12 +117,6 @@ pub struct GoApi_vtable {
*mut u64,
*mut UnmanagedVector, // result
) -> i32,
pub contract_code: extern "C" fn(
*const api_t,
U8SliceView, // addr
*mut u64,
*mut UnmanagedVector, // result
) -> i32,
pub call: extern "C" fn(
*const api_t,
U8SliceView, // addr
Expand Down Expand Up @@ -578,18 +547,6 @@ impl Backend for apiWrapper {
(Ok(d), used_gas)
}

fn contract_code(&self, contract: Address) -> BackendResult<Vec<u8>> {
let mut used_gas = 0_u64;
let mut data = UnmanagedVector::default();
let go_result = (self.api.vtable.contract_code)(self.api.state, U8SliceView::new(Some(&contract)), &mut used_gas as *mut u64, &mut data as *mut UnmanagedVector);
check_go_result!(go_result, used_gas, "contract_code");
let d = match data.consume() {
Some(v) => v,
None => Vec::new()
};
(Ok(d), used_gas)
}

fn contract_addr(&self, code: &[u8], args: &[u8], nonce: &[u8]) -> BackendResult<Address> {
let mut used_gas = 0_u64;
let mut data = UnmanagedVector::default();
Expand Down

0 comments on commit a37819c

Please sign in to comment.