-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to put dapps and tokens live.
- Loading branch information
Showing
51 changed files
with
1,569 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file contains information which helps Meteor properly upgrade your | ||
# app when you run 'meteor update'. You should check it into version control | ||
# with your project. | ||
|
||
notices-for-0.9.0 | ||
notices-for-0.9.1 | ||
0.9.4-platform-file | ||
notices-for-facebook-graph-api-2 | ||
1.2.0-standard-minifiers-package | ||
1.2.0-meteor-platform-split | ||
1.2.0-cordova-changes | ||
1.2.0-breaking-changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file contains a token that is unique to your project. | ||
# Check it into your repository along with the rest of this directory. | ||
# It can be used for purposes such as: | ||
# - ensuring you don't accidentally deploy one app on top of another | ||
# - providing package authors with aggregated statistics | ||
|
||
lqwpxe55lh9nnszrp6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Meteor packages used by this project, one per line. | ||
# Check this file (and the other files in this directory) into your repository. | ||
# | ||
# 'meteor add' and 'meteor remove' will edit this file for you, | ||
# but you can also edit it by hand. | ||
|
||
meteor-base # Packages every Meteor app needs to have | ||
mobile-experience # Packages for a great mobile UX | ||
mongo # The database Meteor supports right now | ||
blaze-html-templates # Compile .html files into Meteor Blaze views | ||
session # Client-side reactive dictionary for your app | ||
jquery # Helpful client-side library | ||
tracker # Meteor's client-side reactive programming library | ||
|
||
standard-minifiers # JS/CSS minifiers run for production mode | ||
es5-shim # ECMAScript 5 compatibility for older browsers. | ||
ecmascript # Enable ECMAScript2015+ syntax in app code | ||
|
||
autopublish # Publish all data to the clients (for prototyping) | ||
insecure # Allow all DB writes from clients (for prototyping) | ||
ethereum:elements | ||
ethereum:accounts | ||
frozeman:template-var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
server | ||
browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
body { | ||
text-align: center; | ||
font-family: sans; | ||
} | ||
|
||
h1 { | ||
font-size: 72pt; | ||
} | ||
|
||
h1 { | ||
font-size: 128pt; | ||
} | ||
|
||
#hot { | ||
color: #550000; | ||
} | ||
|
||
#cold { | ||
color: #000044; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<head> | ||
<title>Hot/Cold</title> | ||
</head> | ||
|
||
<body> | ||
{{> hot_cold }} | ||
{{> dapp_modalPlaceholder}} | ||
</body> | ||
|
||
<template name="hot_cold"> | ||
<h1 id="temperatures"> | ||
<span id="hot">{{ hot }}</span><br/> | ||
<span id="cold">{{ cold }}</span><br/> | ||
</h1> | ||
</template> | ||
|
||
<template name="swap_hot_cold"> | ||
<h2>Swap temperatures</h2> | ||
<h3>Pay gas from account:</h3> | ||
{{> dapp_selectAccount accounts=my_accounts}} | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* HotCold - Ethereum contract of relational physical/perceptual properties. | ||
Copyright (C) 2015, 2016 Rhea Myers <rob@Rhea Myers.org> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
var SWAP_ACCOUNT_SELECTOR = '.dapp-modal-container .dapp-select-account'; | ||
|
||
var bytesToString = function (value) { | ||
return web3.toAscii(value).replace(/\0+$/, ""); | ||
}; | ||
|
||
if (Meteor.isClient) { | ||
|
||
Template.hot_cold.helpers({ | ||
hot: function () { | ||
return Session.get('hot'); | ||
}, | ||
cold: function () { | ||
return Session.get('cold'); | ||
} | ||
}); | ||
|
||
// Keep track of when we're updating the contract state on the blockchain | ||
// and don't show the update dialog during that time so the user doesn't | ||
// waste gas trying to change it again. | ||
var updating = false; | ||
|
||
Template.hot_cold.events({ | ||
'click': function(){ | ||
if (! updating) { | ||
EthElements.Modal.question({ | ||
template: 'swap_hot_cold', | ||
data: { | ||
my_accounts: EthAccounts.find().fetch() | ||
}, | ||
ok: function(){ | ||
updating = true; | ||
var hot_cold = HotCold.deployed(); | ||
// Update the state on the blockchain | ||
var account = TemplateVar.getFrom(SWAP_ACCOUNT_SELECTOR, 'value'); | ||
hot_cold.swap({ from: account }).then(function(value) { | ||
updating = false; | ||
}).catch(function(e) { | ||
console.log(e); | ||
alert("Error sending toggling; see log."); | ||
}); | ||
}, | ||
cancel: true | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
// Why do we put this inside window.onload? | ||
// Truffle adds init code *after* this file is inlined, so we can't access | ||
// HotCold.deployed here as it doesn't exist until the init code is called. | ||
window.onload = function() { | ||
|
||
EthAccounts.init(); | ||
|
||
var hot_cold = HotCold.deployed(); | ||
|
||
hot_cold.hot.call().then(function(value) { | ||
var string_value = bytesToString(value); | ||
Session.setDefault('hot', string_value); | ||
}); | ||
|
||
hot_cold.cold.call().then(function(value) { | ||
var string_value = bytesToString(value); | ||
Session.setDefault('cold', string_value); | ||
}); | ||
|
||
hot_cold.Swap({}, function(error, result){ | ||
if (! error) { | ||
// Store the new state in local storage, updating the UI as a result | ||
// Session.set('hot', bytesToString(result.args.hot)); | ||
// Session.set('hot', bytesToString(result.args.cold)); | ||
// BUT events with more than one value are borked in webthree.js atm | ||
hot_cold.hot.call().then(function(value) { | ||
var string_value = bytesToString(value); | ||
Session.set('hot', string_value); | ||
}); | ||
|
||
hot_cold.cold.call().then(function(value) { | ||
var string_value = bytesToString(value); | ||
Session.set('cold', string_value); | ||
}); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
if (Meteor.isServer) { | ||
Meteor.startup(function () { | ||
// code to run on server at startup | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* HotCold - Ethereum contract of relational physical/perceptual properties. | ||
Copyright (C) 2015, 2016 Rhea Myers <rob@Rhea Myers.org> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
contract HotCold { | ||
|
||
// Public generates a getter, e.g contract.hot() | ||
|
||
bytes4 public hot; | ||
bytes4 public cold; | ||
|
||
event Swap (bytes4 hot, bytes4 cold); | ||
|
||
// Swaps the values, so not const. And doesn't return a value, so no return. | ||
|
||
function swap () { | ||
bytes4 temp = hot; | ||
hot = cold; | ||
cold = temp; | ||
Swap(hot, cold); | ||
} | ||
|
||
// Constructor, called during contract creation, cannot be called after | ||
|
||
function HotCold () { | ||
cold = "cold"; | ||
hot = "hot"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.