-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use invokeExternalContract to do a token transfer #23
Comments
I've been trying this feature myself and I'm experiencing similar issues as @micmac0 My token contract is: https://monitor.credits.com/testnet-r4_2/contract/6vNF6KMXHqj6UtHgSVYKyf24v4KMRXDC5TzpiMkMUihB After that I created a simple contract that calls the import com.credits.scapi.annotations.*;
import com.credits.scapi.v0.*;
public class simpleContract extends SmartContract {
public simpleContract() {
}
@UsingContract(address = "6vNF6KMXHqj6UtHgSVYKyf24v4KMRXDC5TzpiMkMUihB", method = "transfer")
public void getValue(String wallet, String tosend) {
Object[] params = new Object[] { wallet, tosend };
Object returnValue = invokeExternalContract("6vNF6KMXHqj6UtHgSVYKyf24v4KMRXDC5TzpiMkMUihB", "transfer", params);
System.out.println(returnValue);
}
} Using a similar contract calling the
executor-log-2019-06-12copy.txt Edit: as the error mentioned that I can not modify the contract, I tried to retrieve the |
Version 417 I call a business method "addNewBet" and this one call token smartcontract to do a transfer.
and logs I got from one of my node :
|
Describe the bug
I created a smartcontract to act as escrow for betting.
I do this :
Also smartcontract was deployed with these options :
@UsingContract(address = "GcqTxR4qjHfzmcYGaMeGi7T1fPf414oKzfTjUjAFKuPB", method = "transfer") in smartcontract before the method i use to call invokeExternalContract
also tried at deployment and execution from client side to specify usedSmartContractsByte with GcqTxR4qjHfzmcYGaMeGi7T1fPf414oKzfTjUjAFKuPB .
used like this in client code :
When I try this method I had :
com.credits.client.node.exception.NodeClientException: Credits Node error: state is empty!
from node smartcontract executor issue seems to be located there :
https://github.com/CREDITSCOM/ewa/blob/master/sc-api/src/main/java/com/credits/scapi/v0/SmartContract.java#L94
smart contract "GcqTxR4qjHfzmcYGaMeGi7T1fPf414oKzfTjUjAFKuPB" can't be modify
I didn t manage to get the error on my node but with previous version I remember the problem seems to be located there :
To Reproduce
Here is the initiator wallet I used :
https://monitor.credits.com/testnet-r4_2/account/Eyh6ZBiM9D9yyLDwFG7nqAwgm8fFfJn7NauZ6bQxsufn#
here is the smartcontract :
https://monitor.credits.com/testnet-r4_2/Contract/5LKBpWvcDXYi4QK9xpx9Mraibj6hqgoai9R6m2Hn1qV3
** Additional question **
Can we transfer token to a smartcontract address ? If so, how can we initiate token transfer token from this same smartcontract as it can t be initiator ?
The text was updated successfully, but these errors were encountered: