Skip to content

Commit

Permalink
java: use new types
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Oct 14, 2020
1 parent 3ed756c commit 673139f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static boolean account_exists(HostContext context, byte[] address) {

/** Get storage callback function. */
static ByteBuffer get_storage(HostContext context, byte[] address, byte[] key) {
return ensureDirectBuffer(context.getStorage(address, key));
return context.getStorage(new Address(address), new Bytes32(key)).getByteBuffer();
}

/** Set storage callback function. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface HostContext {
* @param address The address of the account the query is about.
* @return true if exists, false otherwise.
*/
boolean accountExists(byte[] address);
boolean accountExists(Address address);

/**
* Get storage function.
Expand All @@ -30,7 +30,7 @@ public interface HostContext {
* @param key The index of the account's storage entry.
* @return The storage value at the given storage key or null bytes if the account does not exist.
*/
ByteBuffer getStorage(byte[] address, byte[] key);
Bytes32 getStorage(Address address, Bytes32 key);

/**
* Set storage function.
Expand All @@ -45,7 +45,7 @@ public interface HostContext {
* @param value The value to be stored.
* @return The effect on the storage item.
*/
int setStorage(byte[] address, byte[] key, byte[] value);
int setStorage(Address address, bytes32 key, Bytes32 value);

/**
* Get balance function.
Expand All @@ -55,7 +55,7 @@ public interface HostContext {
* @param address The address of the account.
* @return The balance of the given account or 0 if the account does not exist.
*/
ByteBuffer getBalance(byte[] address);
ByteBuffer getBalance(Address address);

/**
* Get code size function.
Expand All @@ -66,7 +66,7 @@ public interface HostContext {
* @param address The address of the account.
* @return The size of the code in the account or 0 if the account does not exist.
*/
int getCodeSize(byte[] address);
int getCodeSize(Address address);

/**
* Get code hash function.
Expand All @@ -78,7 +78,7 @@ public interface HostContext {
* @param address The address of the account.
* @return The hash of the code in the account or null bytes if the account does not exist.
*/
ByteBuffer getCodeHash(byte[] address);
Bytes32 getCodeHash(Address address);

/**
* Copy code function.
Expand All @@ -91,7 +91,7 @@ public interface HostContext {
* @param address The address of the account.
* @return A copy of the requested code.
*/
ByteBuffer getCode(byte[] address);
ByteBuffer getCode(Address address);

/**
* Selfdestruct function.
Expand All @@ -102,7 +102,7 @@ public interface HostContext {
* @param address The address of the contract to be selfdestructed.
* @param beneficiary The address where the remaining ETH is going to be transferred.
*/
void selfdestruct(byte[] address, byte[] beneficiary);
void selfdestruct(Address address, Address beneficiary);

/**
* This function supports EVM calls.
Expand Down Expand Up @@ -145,5 +145,5 @@ public interface HostContext {
* @param topics The the array of topics attached to the log.
* @param topicCount The number of the topics. Valid values are between 0 and 4 inclusively.
*/
void emitLog(byte[] address, byte[] data, int dataSize, byte[][] topics, int topicCount);
void emitLog(Address address, byte[] data, int dataSize, byte[][] topics, int topicCount);
}

0 comments on commit 673139f

Please sign in to comment.