Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
4 devs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstep committed Dec 8, 2017
1 parent 3023df3 commit cd31ca2
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 34 deletions.
2 changes: 1 addition & 1 deletion DApps/dicedapp_v2/bankroller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//(function(){
window.MultDApp = (function(){
window.DiceApp = (function(){
let DApp = new DCLib.DApp({slug : 'dicegame_v3'})

return DApp
Expand Down
2 changes: 1 addition & 1 deletion DApps/dicedapp_v2/dapp_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DCLib.defineDAppLogic('dicegame_v3', function(){
const _self = this

const MAX_RAND_NUM = 65536
const MAX_RAND_NUM = 65535
const HOUSEEDGE = 0.02 // 2%

let history = []
Expand Down
31 changes: 14 additions & 17 deletions src/contracts/contracts/paychannel.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 19 additions & 11 deletions src/model/DApps/DApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,19 @@ export default class DApp {
const connection_id = Utils.makeSeed()
const user_id = params.user_id


if(this.users[user_id]) {
if (this.users[user_id].channel) {
return
} else this.users[user_id].logic.payChannel.reset()
this.users[user_id].logic = payChannelWrap(this.logic)

setTimeout(()=>{
this.response(params, {id:this.users[user_id].id}, this.sharedRoom)
console.log('User '+user_id+' REconnected to '+this.slug)
}, 999)

return
// if (this.users[user_id].channel) {
// }
// this.users[user_id].logic.payChannel.reset()
}

this.users[user_id] = {
Expand Down Expand Up @@ -341,15 +350,15 @@ export default class DApp {
console.log('⛽ gasLimit:', gasLimit)

const receipt = await this.PayChannel().methods
.openChannel(
.open(
channel_id , // random bytes32 id
player_address ,
bankroller_address ,
player_deposit ,
bankroller_deposit ,
session , // integer num/counter
ttl_blocks , // channel ttl in blocks count
game_data.value ,
// game_data.value ,
signed_args
).send({
gas : gasLimit ,
Expand All @@ -368,11 +377,11 @@ export default class DApp {

console.log('open channel result', receipt)

// TODO
const checkTimeout = setTimeout(run = () => {

if (this.timer === 0) { this._closeByTimeout(checkTimeout) }
this.timer--
setTimeout(run, 1000)
// if (this.timer === 0) { this._closeByTimeout(checkTimeout) }
// this.timer--
// setTimeout(run, 1000)
}, 1000)

this.users[params.user_id].paychannel = {
Expand Down Expand Up @@ -401,7 +410,7 @@ export default class DApp {
const bool = params.close_args.bool

// Check Sig
const hash = Utils.sha3(channel_id, player_balance, bankroller_balance, session, bool)
const hash = Utils.sha3(channel_id, player_balance, bankroller_balance, session)
const rec_openkey = web3.eth.accounts.recover(hash, signed_args)

if (params.user_id != rec_openkey) {
Expand Down Expand Up @@ -439,7 +448,6 @@ export default class DApp {
player_balance ,
bankroller_balance ,
session ,
bool ,
signed_args
).send({
gas : gasLimit ,
Expand Down
2 changes: 1 addition & 1 deletion src/view/components/app.tag
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import $ from 'jquery'
this.on('mount', ()=>{
route((screen, action, other)=>{
if (!screen) {
screen = 'wallet'
screen = 'dev'
}

if (!localStorage.keysSaved) {
Expand Down
2 changes: 1 addition & 1 deletion src/view/components/mainmenu.tag
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import route from 'riot-route'
this.on('mount', ()=>{
route((screen, action, other)=>{
if (!screen) {
screen = 'wallet'
screen = 'dev'
}

if (!localStorage.keysSaved) {
Expand Down
6 changes: 6 additions & 0 deletions src/view/components/screens/dev/dapps_list.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ dapps_list {
}
}

.d-path {
cursor:pointer;
&:hover {
opacity: 0.9;
}
}

.upload-block {
margin: 40px 0 0 0;
Expand Down
11 changes: 9 additions & 2 deletions src/view/components/screens/dev/dapps_list.tag
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ import './dapps_list.less'
this.toggleConfig = e =>{
e.preventDefault()
e.item.dapp.show_config = !e.item.dapp.show_config
console.info('e.item.show_config',e.item.dapp.show_config);
this.update()
}

Expand All @@ -116,7 +115,15 @@ import './dapps_list.less'
e.preventDefault()

alert('deploy SAM )')
}

this.copy = (e)=>{
e.preventDefault()
if (!e.target.innerText) {
return
}

App.view.copyToClipboard( e.target.innerText )
}
</script>

Expand Down Expand Up @@ -152,7 +159,7 @@ import './dapps_list.less'
<div class="upload-block">
<div class={other:true, show:!isMac}>
For add DApp to list, place folder width dapp.manifest file
to <span>{dapps_path}</span>
to <span class="d-path" onclick={copy}>{dapps_path}</span>
</div>

<div class={macos:true, show:isMac}>
Expand Down

0 comments on commit cd31ca2

Please sign in to comment.