Commit 354a5ef6 authored by Rob Myers's avatar Rob Myers

New version of art-is.

parent 6155aa50
# 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
1.3.0-split-minifiers-package
# 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
# 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
#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
standard-minifier-css
standard-minifier-js
3stack:[email protected]
alexvandesande:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
ethereum:[email protected]
ethereum:[email protected]
ethereum:[email protected]
ethereum:[email protected]
frozeman:[email protected]
frozeman:[email protected]
frozeman:[email protected]
frozeman:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
modules[email protected]
modules-runti[email protected]
[email protected]
[email protected]
[email protected]
numeral:[email protected]_1
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
body {
text-align: center;
font-family: sans;
}
h1 {
/*font-size: 72pt;*/
}
.art-is-wrapper {
position: absolute;
top: 50%; left: 50%; width: 500px; height: 600px;
margin: -200px 0 0 -250px;
text-align: left;
}
<head>
<title>Art Is...</title>
</head>
<body>
<div class="art-is-wrapper">
<h1>Art is</h1>
{{> art_is}}
</div>
{{> dapp_modalPlaceholder}}
</body>
<template name="art_is">
{{#each definitions}}
{{> display_definition}}
{{/each}}
</template>
<template name="display_definition">
<p class="definition display">
<b>{{index}}:</b>
<span class="initial-cap">
{{lookupExtent extent}}
{{lookupConnection connection}}
{{lookupRelation relation}}
{{lookupSubject subject}}.
</span>
<!-- Add mouse-over to display Set by {{setter}} -->
<button data-definition="{{number}}" hidden>Edit</button>
</p>
</template>
<template name="edit_definition">
<h2>Change Definition {{index}}</h2>
{{lookupExtent extent}} {{lookupConnection connection}}
{{lookupRelation relation}} {{lookupSubject subject}}.
<p>This will cost {{cost}}, plus gas</p>
<h3>Pay fee and gas from account:</h3>
{{> dapp_selectAccount accounts=my_accounts}}
</template>
/* ArtIs - Ethereum contract to define art.
Copyright (C) 2015, 2016 Rob Myers <[email protected]>
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 COST_TO_CHANGE = [];
var DEFINITION_COUNT = 8;
var EXTENT = ["",
"good because it is", "bad because it is", "moral because it is",
"immoral because it is", "creepy because it is",
"paradoxically", "slightly", "somewhat", "very", "totally",
"always", "never", "sometimes", "occasionally", "often",
"unavoidable because it is", "unfortunate because it is",
"valuable because it is", "worthless because it is",
"ridiculous because it is",
"a valuable asset class because it is", "arguably", "inarguably",
"tendentiously", "rebarbatively", "elsewhere", "everywhere",
"nowhere", "seen to be", "seemingly",
"determined by the fact that it is"
];
var CONNECTION = ["",
"not", "ontologically", "epistemologically", "logically",
"psychologically",
"childishly", "sophisticatedly", "conservatively",
"liberally", "ironically",
"creepily", "radically", "queerly", "problematically",
"neoliberally",
"otiosely", "maybe", "possibly", "extensively", "critically",
"superstructurally", "genetically", "contingently",
"deterministically", "cybernetically",
"systemically", "institutionally", "obviously", "obliquely",
"tragically", "joyously"
];
var RELATION = ["",
"reliant on", "derivative of", "determined by", "defined by",
"subservient to",
"reacting to", "commenting on", "embracing", "resolving",
"transcending",
"valenced by", "critiquing", "attacking", "destroying",
"obviating",
"leavened by", "ironising", "complicit in", "captured by",
"building on",
"extending", "subsuming", "subsumed by", "supportive of",
"remixing",
"detourning", "queering", "deconstructing", "interrogating",
"commenting on", "a correlate of"
];
var SUBJECT = ["everything",
"techne", "society", "politics", "materiality", "identity",
"emotion", "critique", "aesthetics", "god", "satan",
"beauty", "horror", "desire", "gender", "revolution",
"economics", "spirituality", "nothing", "fascism",
"communism", "the Internet", "nature", "the Anthropocene",
"the world", "the past", "the future", "the present", "eternity",
"hyperstition"];
var TOGGLE_ACCOUNT_SELECTOR = '.dapp-modal-container .dapp-select-account';
var setDefinitionFromStruct = function (index, struct) {
var definitions = Session.get('definitions');
definitions[index]['extent'] = struct[0].toNumber();
definitions[index]['connection'] = struct[1].toNumber();
definitions[index]['relation'] = struct[2].toNumber();
definitions[index]['subject'] = struct[3].toNumber();
definitions[index]['setter'] = struct[4].toString();
// Store the new status in local storage, updating the UI as a result
// Since we mutate definitions this slightly superfluous, flag instead?
Session.set('definitions', definitions);
};
var setDefinitionFromStructCreator = function (index) {
return function (struct) {
setDefinitionFromStruct (index, struct);
};
}
/*var setDefinitionFromEvent = function (event) {
var definitions = Session.get('definitions');
console.log(definition);
var index = event[0].toNumber();
definitions[index]['extent'] = event[1].toNumber();
definitions[index]['connection'] = event[2].toNumber();
definitions[index]['relation'] = event[3].toNumber();
definitions[index]['subject'] = event[4].toNumber();
definitions[index]['setter'] = event[5].toString();
// Store the new status in local storage, updating the UI as a result
// Since we mutate definitions this slightly superfluous, flag instead?
Session.set('definitions', definitions);
};*/
if (Meteor.isClient) {
Template.registerHelper('costToChange', function(index) {
return COST_TO_CHANGE[index];
});
Template.registerHelper('extents', function () {
return EXTENT;
});
Template.registerHelper('lookupExtent', function (index) {
return EXTENT[index];
});
Template.registerHelper('connections', function () {
return CONNECTION;
});
Template.registerHelper('lookupConnection', function (index) {
return CONNECTION[index];
});
Template.registerHelper('relations', function () {
return RELATION;
});
Template.registerHelper('lookupRelation', function (index) {
return RELATION[index];
});
Template.registerHelper('subjects', function () {
return SUBJECT;
});
Template.registerHelper('lookupSubject', function (index) {
return SUBJECT[index];
});
Template.art_is.helpers({
definitions: function () {
return Session.get('definitions');
}
});
// 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.edit_definition.events({
'click': function(){
if (! updating) {
EthElements.Modal.question({
template: 'toggle_art_is',
data: {
my_accounts: EthAccounts.find().fetch()
},
ok: function(){
updating = true;
var art_is = ArtIs.deployed();
// Update the state on the blockchain
var account = TemplateVar.getFrom(TOGGLE_ACCOUNT_SELECTOR, 'value');
art_is.setDefinition({ from: account }).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
// ArtIs.deployed here as it doesn't exist until the init code is called.
window.onload = function() {
EthAccounts.init();
var art_is = ArtIs.deployed();
// Store the initial definitions state
var definitions = Array();
for (var i = 0; i < DEFINITION_COUNT; i++) {
definitions[i] = {index:i};
}
Session.set('definitions', definitions);
for (var i = 0; i < DEFINITION_COUNT; i++) {
var setDefinition = setDefinitionFromStructCreator (i);
art_is.definitions(i).then(setDefinition);
}
// When a definition changes, update value in session and thereby UI
// If this shows the usual > 1 arg problem, that's fine the index is 1
// so get that and fetch the actual values
art_is.DefinitionChanged({}, function(error, result){
if (! error) {
setDefinition(result);
/*var index = result[0].toNumber();
art_is.definitions(index).then(function (definition) {
setDefinition(index, definition);
});*/
}
});
};
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
/* ArtIs - Ethereum contract to define art.
Copyright (C) 2015, 2016 Rob Myers <[email protected]>
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 ArtIs {
event DefinitionChanged(uint8 number, uint8 extent, uint8 connection,
uint8 relation, uint8 subject, address setter);
uint8 constant NUM_TERMS = 32;
struct Definition {
uint8 extent;
uint8 connection;
uint8 relation;
uint8 subject;
address setter;
}
Definition[8] public definitions;
function indexPrice (uint8 index) returns (uint price) {
uint[8] memory prices;
// We don't have array initializers yet, so slow and steady...
prices[0] = 1 wei;
prices[1] = 1 szabo;
prices[2] = 1 finney;
prices[3] = 1 ether;
prices[4] = 10 ether;
prices[5] = 100 ether;
prices[6] = 1000 ether;
prices[7] = 10000 ether;
return prices[index];
}
function initialValue (uint8 definition) returns (uint8 value) {
value = definition;
}
function initDefinition (uint8 index) private
returns (Definition definition) {
definition = Definition({extent: initialValue(index),
connection: initialValue(index),
relation: initialValue(index),
subject: initialValue(index),
setter: tx.origin});
}
function ArtIs () {
for (uint8 i = 0; i < definitions.length; i++) {
definitions[i] = initDefinition(i);
}
}
function setDefinition (uint8 index, uint8 extent, uint8 connection,
uint8 relation, uint8 subject) {
// Make sure all the values are valid
if ((index < definitions.length) &&
(msg.value == indexPrice(index))
&& (extent < NUM_TERMS)
&& (connection < NUM_TERMS)
&& (relation < NUM_TERMS)
&& (subject < NUM_TERMS)) {
// We send payment to the previous setter, so get their address
address refund_to = definitions[index].setter;
definitions[index].extent = extent;
definitions[index].connection = connection;
definitions[index].relation = relation;
definitions[index].subject = subject;
definitions[index].setter = tx.origin;
if (! refund_to.send(indexPrice(index))) {
throw;
}
DefinitionChanged(index, extent, connection, relation, subject,
tx.origin);
}
}
}
// Factory "morphs" into a Pudding class.
// The reasoning is that calling load in each context
// is cumbersome.
(function() {
var contract_data = {
abi: [{"constant":false,"inputs":[{"name":"definition","type":"uint8"}],"name":"initialValue","outputs":[{"name":"value","type":"uint8"}],"type":"function"},{"constant":false,"inputs":[{"name":"index","type":"uint8"},{"name":"extent","type":"uint8"},{"name":"connection","type":"uint8"},{"name":"relation","type":"uint8"},{"name":"subject","type":"uint8"}],"name":"setDefinition","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"index","type":"uint8"}],"name":"indexPrice","outputs":[{"name":"price","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"definitions","outputs":[{"name":"extent","type":"uint8"},{"name":"connection","type":"uint8"},{"name":"relation","type":"uint8"},{"name":"subject","type":"uint8"},{"name":"setter","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"number","type":"uint8"},{"indexed":false,"name":"extent","type":"uint8"},{"indexed":false,"name":"connection","type":"uint8"},{"indexed":false,"name":"relation","type":"uint8"},{"indexed":false,"name":"subject","type":"uint8"},{"indexed":false,"name":"setter","type":"address"}],"name":"DefinitionChanged","type":"event"}],
binary: "606060405260005b600860ff8216101561005b5761006a8160a06040519081016040528060008152602001600081526020016000815260200160008152602001600081526020015060a0604051908101604052806100f1845b90565b506103978061012b6000396000f35b600060ff8316600881101561000257905081518154602084015160408501516060860151608096909601516401000000000263010000009690960262010000919091026101009290920260ff199390931690931761ff0019169190911762ff000019161763ff000000191617602060020a60c060020a031916919091179055600101610007565b81526020016100ff84610058565b815260200161010d84610058565b815260200161011b84610058565b815232602091909101529291505056606060405260e060020a600035046346523b69811461003c5780634e70554914610054578063e392a5211461007f578063fd51fc4c1461012d575b005b6040805160ff60043516815290519081900360200190f35b61003a6004356024356044356064356084356000600860ff87161080156101ca57506101c786610086565b6101776004355b6000610100604051908101604052806008905b60008152602001906001900390816100995750506001815264e8d4a51000602082015266038d7ea4c680006040820152670de0b6b3a76400006060820152678ac7230489e80000608082015268056bc75e2d6310000060a0820152683635c9adc5dea0000060c082015269021e19e0c9bab240000060e08201528060ff841660088110156100025760200201519392505050565b61018960043560008160088110156100025790505460ff818116925061010082048116916201000081048216916301000000820416906401000000009004600160a060020a031685565b60408051918252519081900360200190f35b6040805160ff968716815294861660208601529285168484015293166060830152600160a060020a0392909216608082015290519081900360a00190f35b34145b80156101d95750602060ff8616105b80156101e85750602060ff8516105b80156101f75750602060ff8416105b80156102065750602060ff8316105b1561037357600060ff8716600881101561000257546401000000009004600160a060020a03169150859060ff8816600881101561000257805460ff1916909217909155849060ff88166008811015610002579050805461ff0019166101009290920291909117905582600060ff8816600881101561000257805462ff00001916620100009390930292909217909155829060ff8816600881101561000257805463ff000000191663010000009390930292909217909155329060ff8816600881101561000257805477ffffffffffffffffffffffffffffffffffffffff0000000019166401000000009390930292909217909155600160a060020a0382169061037b88610086565b6040805160ff888116825287811660208301528681168284015285811660608301528416608082015232600160a060020a031660a082015290517fc9d34124c372f23861c5aa70eab2353e3d966a10c866b730a220846988f167d29181900360c00190a15b505050505050565b6040516000818181858888f19350505050151561030e5761000256",
unlinked_binary: "606060405260005b600860ff8216101561005b5761006a8160a06040519081016040528060008152602001600081526020016000815260200160008152602001600081526020015060a0604051908101604052806100f1845b90565b506103978061012b6000396000f35b600060ff8316600881101561000257905081518154602084015160408501516060860151608096909601516401000000000263010000009690960262010000919091026101009290920260ff199390931690931761ff0019169190911762ff000019161763ff000000191617602060020a60c060020a031916919091179055600101610007565b81526020016100ff84610058565b815260200161010d84610058565b815260200161011b84610058565b815232602091909101529291505056606060405260e060020a600035046346523b69811461003c5780634e70554914610054578063e392a5211461007f578063fd51fc4c1461012d575b005b6040805160ff60043516815290519081900360200190f35b61003a6004356024356044356064356084356000600860ff87161080156101ca57506101c786610086565b6101776004355b6000610100604051908101604052806008905b60008152602001906001900390816100995750506001815264e8d4a51000602082015266038d7ea4c680006040820152670de0b6b3a76400006060820152678ac7230489e80000608082015268056bc75e2d6310000060a0820152683635c9adc5dea0000060c082015269021e19e0c9bab240000060e08201528060ff841660088110156100025760200201519392505050565b61018960043560008160088110156100025790505460ff818116925061010082048116916201000081048216916301000000820416906401000000009004600160a060020a031685565b60408051918252519081900360200190f35b6040805160ff968716815294861660208601529285168484015293166060830152600160a060020a0392909216608082015290519081900360a00190f35b34145b80156101d95750602060ff8616105b80156101e85750602060ff8516105b80156101f75750602060ff8416105b80156102065750602060ff8316105b1561037357600060ff8716600881101561000257546401000000009004600160a060020a03169150859060ff8816600881101561000257805460ff1916909217909155849060ff88166008811015610002579050805461ff0019166101009290920291909117905582600060ff8816600881101561000257805462ff00001916620100009390930292909217909155829060ff8816600881101561000257805463ff000000191663010000009390930292909217909155329060ff8816600881101561000257805477ffffffffffffffffffffffffffffffffffffffff0000000019166401000000009390930292909217909155600160a060020a0382169061037b88610086565b6040805160ff888116825287811660208301528681168284015285811660608301528416608082015232600160a060020a031660a082015290517fc9d34124c372f23861c5aa70eab2353e3d966a10c866b730a220846988f167d29181900360c00190a15b505050505050565b6040516000818181858888f19350505050151561030e5761000256",
address: "0xe6887d4e587db4b2d475f9deb44f63918e61f398",
generated_with: "2.0.9",
contract_name: "ArtIs"
};
function Contract() {
if (Contract.Pudding == null) {
throw new Error("ArtIs error: Please call load() first before creating new instance of this contract.");
}
Contract.Pudding.apply(this, arguments);
};
Contract.load = function(Pudding) {
Contract.Pudding = Pudding;
Pudding.whisk(contract_data, Contract);
// Return itself for backwards compatibility.
return Contract;
}
Contract.new = function() {
if (Contract.Pudding == null) {
throw new Error("ArtIs error: Please call load() first before calling new().");
}
return Contract.Pudding.new.apply(Contract, arguments);
};
Contract.at = function() {
if (Contract.Pudding == null) {
throw new Error("ArtIs error: Please call load() first before calling at().");
}
return Contract.Pudding.at.apply(Contract, arguments);
};
Contract.deployed = function() {
if (Contract.Pudding == null) {
throw new Error("ArtIs error: Please call load() first before calling deployed().");
}
return Contract.Pudding.deployed.apply(Contract, arguments);
};
if (typeof module != "undefined" && typeof module.exports != "undefined") {
module.exports = Contract;
} else {
// There will only be one version of Pudding in the browser,
// and we can use that.
window.ArtIs = Contract;
}
})();
This source diff could not be displayed because it is too large. You can view the blob instead.