Skip to content

Commit

Permalink
Start moving to truffle and meteor.
Browse files Browse the repository at this point in the history
  • Loading branch information
rheaplex committed Jan 29, 2016
1 parent 63d8fa0 commit bb7f150
Show file tree
Hide file tree
Showing 175 changed files with 3,713 additions and 50 deletions.
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Artworld Ethereum
=================

Ethereum art projects.

See projects/ for project sources.

truffle-meteor-build is a build helper script

Dependencies
------------

truffle, meteor, testrpc

https://github.com/consensys/truffle

https://www.meteor.com/

https://github.com/ConsenSys/eth-testrpc

Running Locally
---------------

In one terminal window, start testrpc:

testrpc

In another window, for e.g. is-art:

cd projects/is-art
truffle deploy
../../truffle-meteor-build

Then open the UI in a web browser

chromium environments/development/meteor/index.html

If you stop testrpc you'll need to deploy again when you restart it.
9 changes: 0 additions & 9 deletions contract/is_art.se

This file was deleted.

44 changes: 44 additions & 0 deletions doc/encodings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Bitmaps

# Text

Utf-8.

# Colours

24-bit CIELAB.

# Paths

Paths are encoded in three bytes:

opcode, param1, param2

Three uint256 variables of these names can be used to store up to 32 path
elements.

## Opcodes

### No params

01 - New Path
10 - Close Path

### One param

32 - Repeat next instruction n times (param1)

### Two Params

01 - Move To x, y (param1, param2)
02 - Relative Move To +x, +y (param1, param2)
03 - Line To x, y (param1, param2)
04 - Relative Line To +x, +y (param1, param2)

### Four params

Two sets of param1, param2, with opcode set to zero.

05 - Curve To x1, y1, x, y (param1, param2, param1, param2)
06 - Curve To x1, y1, x, y (param1, param2, param1, param2)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions old/contract/art_is.so
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
contract ArtIs {

struct Definition {
uint8 slot1;
uint8 slot2;
uint8 slot3;
uint8 slot4;
}

mapping;



;; Constant values
;; Price base (wei), doubled for each definition up to DEFS-COUNT
(def 'PRICE-BASE 10)
;; Add to the index to get the price base exponent
(def 'PRICE-FACTOR-ADD 10)
;; Number of definitions
(def 'DEFS-COUNT 12)
;; Range of values for definitions
(def 'DEF-MIN 0x1)
(def 'DEF-MAX 0x0F0F0F0F)

;; Storage locations
(def 'artist 0x10)
(def 'defs-base 0x100)
(def 'theorists-base 0x200)

;; State
;; Contract owner/payee
[[artist]] (caller)

(return
0x0
(lll
{
[action] (calldataload 0)
(when (= @action "set")
{
[index] (calldataload 32)
[definition] (calldataload 64)
[price] (exp PRICE-BASE (+ @index 1 PRICE-FACTOR-ADD))
;; If the index is in range and the caller paid enough to set it
(when (&& (>= @definition DEF-MIN)
(<= @definition DEF-MAX)
(< @index DEFS-COUNT)
(= (callvalue) @price))
{
;; Update definition
[[(+ defs-base @index)]] @definition
[[(+ theorists-base @index)]] (caller)
(- (gas) 100) @@artist @price 0 0 0 0
})
})
}
0x0))
}
39 changes: 39 additions & 0 deletions old/contract/as_it_is.lll
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;; Pay to set the aesthetic properties of an artwork (based on your address)
{
;; Constant values
;; Price increment (wei)
(def 'PRICE-INCREMENT 1000)

;; Storage locations
(def 'artist 0x10)
(def 'price 0x11)
(def 'aesthetics 0x12)

;; State
;; Artist
[[artist]] (caller)
;; Price (wei)
[[price]] 1000000
;; Last setter, also source of colour and shape
[[aesthetics]] (caller)

(return
0x0
(lll
{
[action] (calldataload 0)
(when (&& (= @action "set")
(= (callvalue) @@price)
(not @@(caller)))
{
;; Record setter, we use their hash to determine aesthetic properties
[[aesthetics]] (caller)
;; Pay artist
(call @@artist (callvalue) 0 0 0 0 0)
;; Record setter, so they cannot set again (artist gets extra freebie)
[[(caller)]] 1
;; Increment cost of setting
[[price]] (+ [[price]] [[PRICE-INCREMENT]])
})
}
0x0))}
File renamed without changes.
24 changes: 24 additions & 0 deletions old/contract/catalogue_raisonne.so
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
contract CatalogueRaisonne {

uint numWorks;
mapping (uint256 => string32) works;

address artist;

function CatalogueRaisonne () {
artist = sender;
numWorks = 0;
}

function addWork (uint256 hash, string32 desc) {
if (msg.sender == artist) {
works[hash] = desc;
numworks++;
}
}

function checkWork (uint256 hash) returns (bool featured) {
return mapping[hash] != null;
}

}
File renamed without changes.
18 changes: 18 additions & 0 deletions old/contract/certificate_of_authenticity.so
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Update to store & use hash of artist and hash (yes, double hash)

contract CertificateOfAuthenticity {

address artist;
int32 artworkHash;

function isAuthentic (address artistCandidate, int32 artworkHashCandidate)
returns (bool authentic) {
return artistCandidate == artist && artworkHashCandidate == artworkHash;
}

function CertificateOfAuthenticity () {
artist = 0x8802b7f0bfa5e9f5825f2fc708e1ad00d2c2b5d6;
artworkHash = 0x76bba376ea574e63ab357b2374d1cee5aa77d24db38115e3824c5cc4f443d5f7;
}

}
File renamed without changes.
3 changes: 3 additions & 0 deletions old/contract/conceptual_art.so
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
contract ConceptualArt {

}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bb7f150

Please sign in to comment.