Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelang committed Nov 29, 2018
1 parent ab6546d commit 8e90b7d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ type StorageKey = Bytes32;
type StorageValue = Bytes32;
type Topic = Bytes32;
type Hash = Bytes32;
// TODO: is this a number of a bytestring?
type Difficulty = Bytes32;

/// Enum representing an error code for EEI calls. Currently used by `codeCopy`, `callDataCopy`,
Expand Down Expand Up @@ -411,19 +410,19 @@ pub fn call_static(gas_limit: u64, address: &Address, data: &[u8]) -> CallResult

/// Creates a contract with the the given code, sending the specified ether value to its address.
pub fn create(value: &EtherValue, data: &[u8]) -> CreateResult {
let mut result: Address = Address::default();
let mut address: Address = Address::default();

let ret = unsafe {
native::ethereum_create(
value.bytes.as_ptr() as *const u32,
data.as_ptr() as *const u32,
data.len() as u32,
result.bytes.as_mut_ptr() as *const u32,
address.bytes.as_mut_ptr() as *const u32,
)
};

match ret {
0 => CreateResult::Successful(result),
0 => CreateResult::Successful(address),
1 => CreateResult::Failure,
2 => CreateResult::Revert,
_ => panic!(),
Expand Down Expand Up @@ -619,7 +618,7 @@ pub fn storage_load(key: &StorageKey) -> StorageValue {

unsafe {
native::ethereum_storageLoad(
key.bytes.as_ptr() as *const u32,
key.bytes.as_mut_ptr() as *const u32,
ret.bytes.as_mut_ptr() as *const u32,
);
}
Expand Down

0 comments on commit 8e90b7d

Please sign in to comment.