forked from blockchain/web3j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hyperledger-web3j#239 from eepstein/master
make generated classes extendable
- Loading branch information
Showing
7 changed files
with
108 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
36 changes: 36 additions & 0 deletions
36
core/src/test/java/org/web3j/contracts/token/ERC20BasicInterface.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 org.web3j.contracts.token; | ||
|
||
import java.math.BigInteger; | ||
import java.util.List; | ||
|
||
import rx.Observable; | ||
|
||
import org.web3j.protocol.core.DefaultBlockParameter; | ||
import org.web3j.protocol.core.RemoteCall; | ||
import org.web3j.protocol.core.methods.response.TransactionReceipt; | ||
|
||
/** | ||
* Describes the Ethereum "Basic" subset of the ERC-20 token standard. | ||
* <p> | ||
* Implementations should provide the concrete <code>TransferEventResponse</code> | ||
* from their token as the generic type "T". | ||
* </p> | ||
* | ||
* @see <a href="https://github.com/ethereum/EIPs/issues/179">ERC: Simpler Token Standard #179</a> | ||
* @see <a href="https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20Basic.sol">OpenZeppelin's zeppelin-solidity reference implementation</a> | ||
*/ | ||
@SuppressWarnings("unused") | ||
public interface ERC20BasicInterface<T> { | ||
|
||
RemoteCall<BigInteger> totalSupply(); | ||
|
||
RemoteCall<BigInteger> balanceOf(String who); | ||
|
||
RemoteCall<TransactionReceipt> transfer(String to, BigInteger value); | ||
|
||
List<T> getTransferEvents(TransactionReceipt transactionReceipt); | ||
|
||
Observable<T> transferEventObservable(DefaultBlockParameter startBlock, | ||
DefaultBlockParameter endBlock); | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
core/src/test/java/org/web3j/contracts/token/ERC20Interface.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 org.web3j.contracts.token; | ||
|
||
import java.math.BigInteger; | ||
import java.util.List; | ||
|
||
import rx.Observable; | ||
|
||
import org.web3j.protocol.core.DefaultBlockParameter; | ||
import org.web3j.protocol.core.RemoteCall; | ||
import org.web3j.protocol.core.methods.response.TransactionReceipt; | ||
|
||
/** | ||
* The Ethereum ERC-20 token standard. | ||
* <p> | ||
* Implementations should provide the concrete <code>ApprovalEventResponse</code> and | ||
* <code>TransferEventResponse</code> from their token as the generic types "R" amd "T". | ||
* </p> | ||
* | ||
* @see <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md">EIPs/EIPS/eip-20-token-standard.md</a> | ||
* @see <a href="https://github.com/ethereum/EIPs/issues/20">ERC: Token standard #20</a> | ||
*/ | ||
@SuppressWarnings("unused") | ||
public interface ERC20Interface<R, T> extends ERC20BasicInterface<T> { | ||
|
||
RemoteCall<BigInteger> allowance(String owner, String spender); | ||
|
||
RemoteCall<TransactionReceipt> approve(String spender, BigInteger value); | ||
|
||
RemoteCall<TransactionReceipt> transferFrom(String from, String to, BigInteger value); | ||
|
||
List<R> getApprovalEvents(TransactionReceipt transactionReceipt); | ||
|
||
Observable<R> approvalEventObservable(DefaultBlockParameter startBlock, | ||
DefaultBlockParameter endBlock); | ||
|
||
} |