-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fdaeb1
commit 99b46c9
Showing
5 changed files
with
138 additions
and
19 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
hedera-base/src/main/java/com/openelements/hedera/base/ContractCallResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.openelements.hedera.base; | ||
|
||
import com.hedera.hashgraph.sdk.Hbar; | ||
import java.math.BigInteger; | ||
|
||
public interface ContractCallResult { | ||
|
||
long gasUsed(); | ||
|
||
Hbar cost(); | ||
|
||
String getString(int index); | ||
|
||
String getAddress(int index); | ||
|
||
boolean getBool(int index); | ||
|
||
byte getInt8(int index); | ||
|
||
|
||
int getInt32(int index); | ||
|
||
long getInt64(int index); | ||
|
||
BigInteger getInt256(int index); | ||
|
||
long getUint8(int index); | ||
|
||
|
||
long getUint32(int index); | ||
|
||
long getUint64(int index); | ||
|
||
BigInteger getUint256(int index); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...ase/src/main/java/com/openelements/hedera/base/implementation/ContractCallResultImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.openelements.hedera.base.implementation; | ||
|
||
import com.hedera.hashgraph.sdk.ContractFunctionResult; | ||
import com.hedera.hashgraph.sdk.Hbar; | ||
import com.openelements.hedera.base.ContractCallResult; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import java.math.BigInteger; | ||
import java.util.Objects; | ||
|
||
public class ContractCallResultImpl implements ContractCallResult { | ||
|
||
private final ContractFunctionResult innerResult; | ||
|
||
public ContractCallResultImpl(@NonNull final ContractFunctionResult innerResult) { | ||
this.innerResult = Objects.requireNonNull(innerResult, "innerResult must not be null"); | ||
} | ||
|
||
@Override | ||
public long gasUsed() { | ||
return innerResult.gasUsed; | ||
} | ||
|
||
@Override | ||
public Hbar cost() { | ||
return innerResult.hbarAmount; | ||
} | ||
|
||
@Override | ||
public String getString(int index) { | ||
return innerResult.getString(index); | ||
} | ||
|
||
@Override | ||
public String getAddress(int index) { | ||
return innerResult.getAddress(index); | ||
} | ||
|
||
@Override | ||
public boolean getBool(int index) { | ||
return innerResult.getBool(index); | ||
} | ||
|
||
@Override | ||
public byte getInt8(int index) { | ||
return innerResult.getInt8(index); | ||
} | ||
|
||
@Override | ||
public int getInt32(int index) { | ||
return innerResult.getInt32(index); | ||
} | ||
|
||
@Override | ||
public long getInt64(int index) { | ||
return innerResult.getInt64(index); | ||
} | ||
|
||
@Override | ||
public BigInteger getInt256(int index) { | ||
return innerResult.getInt256(index); | ||
} | ||
|
||
@Override | ||
public long getUint8(int index) { | ||
return innerResult.getUint8(index); | ||
} | ||
|
||
@Override | ||
public long getUint32(int index) { | ||
return innerResult.getUint32(index); | ||
} | ||
|
||
@Override | ||
public long getUint64(int index) { | ||
return innerResult.getUint64(index); | ||
} | ||
|
||
@Override | ||
public BigInteger getUint256(int index) { | ||
return innerResult.getUint256(index); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters