Closed micmac0 closed 5 years ago
Hi!
Big thanks for all your comments! We are reviewing some possible alternatives in order to add new and creative functionalities which can be implemented by developers to create token smart-contracts. In this regard, we are studying a possible improvement of this standard ERC-223 that can be released in our Credits blockchain. We expect it will be available soon for all the community.
Is your feature request related to a problem? Please describe. First of all thank you angelesmanzo for you feedback on #22. I suggest to continue our discussion here as we are going away from initial subject. ERC-233 answer perfectly to my first concern to not use 2 transactions to do one transfer. I hope you will go this way.
I read your answear but it looks like business logic is written in token smartcontract ? I will try to explain a bit more the idea I wish to implement : I create a smartcontract for token , let s call is "token contract" Then I dynamically create new contract for each bet i want to create : call it "bet contract"
The idea is : I create bet contract that contain the token address to be able to call token transfer through invokeExternalContract. So in bet method (in bet contract) I do business logic and then call a approve / transferFrom to send token to smartcontract address. After some time (can be hours and better can be away), smartcontract close bets and then compute winners. When done it need automatically pay all winners.
Describe the solution you'd like To pay all winners automatically i think we can have two ways : 1 / Add a new property in token contract like :
private Map<String, String> approvedContract; //<OwnerOfBetContract, BetContractAddress
then when I create a new bet contract I call also in token contract call this new method : public void approveBetContract(String betContract) { Object[] params = new Object[] { }; String newBetOwnerContract = (String) invokeExternalContract(betContract, "getOwner", params); approvedContract.put(newBetOwnerContract, betContract); }
Now I need to update either transfer or transferFrom code to allow also this new approvedContract map when token transfer is called This way here i have a second list of approved address that I could call automatically from a cron in my 3rd party program with bet contract owner address right ? This way i can do automatic payment instead of asking to each user to create transactions to get funds back. Looks better for automation ?
The problem I see here is that initiator wallet have 0 Token, this is the smartcontract who get token so I guess I only can use and adapt transferFrom method ?
Describe alternatives you've considered (seems better to me) I think with automation, we could add a new variable in
com/credits/scap/v0/SmartContract.java
. This could be the smartContractCaller and create a new method transferFromSmartContract that would check smartContractCaller instead of initiator. (If fees payment are required, they can be checked from smartContractCaller owner address). This way may be later on we could create Cron inside smartcontract that automatically will be able to do payements.