AschPlatform / asch

Asch is an efficient, flexible, safe and decentralized application platform, which was initially designed to lower the barrier to entry for developers.The services provided by the Asch platform include a public chain and a set of application SDKs.
478 stars 147 forks source link

Question: How to hold some assets till the a contract has been finished? #251

Closed bassjobsen closed 6 years ago

bassjobsen commented 6 years ago

For instance i like to create some kind of betting contract between two users (addresses) User1 pays 1 asset, then we wait for User2 who also pays 1 asset, now the contract choose a random winner who got both (2) assets.

The issue is not the possibility per se, but about the number of fees to pay.

What works 1) User1 pays 1 asset to the bank (1 asset + 1 fee) 2) User2 pays 1 asset to the bank (1 asset + 1 fee) 3) The bank pays to the winner (2 asset + 1 fee, the bank has to pay fees too)

total number of fees used: 3

Question 1) User1 pays 1 asset (1 asset + 1 fee) 2) wait... until User2 pays 1 asset AND send 2 assets to the winner in the same contract (1 fee)

total number of fees used: 2

When the balance of user1 is checked at the start of the contract, he can start a new contract with the same balance when we wait for user2?

bassjobsen commented 6 years ago

closed the question can be found at https://stackoverflow.com/questions/51994988/how-to-hold-some-assets-till-the-a-contract-has-been-finished now