[NOTE] $JAVAEE_DIR
indicates the top level directory that contains this repository. You need to replace it with your own directory path.
$ cd $JAVAEE_DIR/samples
$ ./compile.sh sampletoken example.SampleToken
...
The jar has been generated at $JAVAEE_DIR/samples/sampletoken/build/dapp.jar
$ cd $JAVAEE_DIR
$ ./gradlew app:dappcomp:run --args='$JAVAEE_DIR/samples/sampletoken/build/dapp.jar -debug'
...
[main] INFO DAppCompiler - Generated $JAVAEE_DIR/samples/sampletoken/build/optimized-debug.jar
If you use mock_server
, copy the optimized jar into the target directory.
If you use goloop
, create a deploy transaction with the optimized jar and deploy it.
The counterpart SM server (mock_server
or goloop
) should be run first before executing the following step.
$ ./gradlew app:execman:run --args='/tmp/ee.socket'
Name | Python | Java |
---|---|---|
External decorator | @external |
@External |
- (readonly) | @external(readonly=True) |
@External(readonly=true) |
Payable decorator | @payable |
@Payable |
Eventlog decorator | @eventlog |
@EventLog |
- (indexed) | @eventlog(indexed=1) |
@EventLog(indexed=1) |
fallback signature | def fallback |
void fallback() |
SCORE initialize | override on_install method |
define a public constructor |
Default parameters | native language support | @Optional |
[NOTE] All external Java methods must have a public
modifier, and should be instance methods.
One SCORE can invoke a external method of another SCORE using the following APIs.
// [package score.Context]
public static Object call(Address targetAddress, String method, Object... params);
public static Object call(BigInteger value,
Address targetAddress, String method, Object... params);
Example of calling
tokenFallback
if (_to.isContract()) {
Context.call(_to, "tokenFallback", _from, _value, dataBytes);
}