diff --git a/forum-network/notes/classes.md b/forum-network/notes/classes.md
deleted file mode 100644
index 36cb19d..0000000
--- a/forum-network/notes/classes.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Primary
-
-## Forum
-
-## ValidationPool
-
-## ReputationToken
-
-## WDAG
-
-# Secondary
-
-## Availability
-
-## Business
-
-## ERC721
-
-## Expert
-
-## Bench
-
-# Tertiary
-
-## Actor
-
-## Action
-
-## Scene
-
-# To Explore
-
-## Exchange
-
-## Storage
-
-## Network
-
-## Wallet
-
-## Agent/UI
-
-## BlockConsensus
diff --git a/forum-network/notes/governance.md b/forum-network/notes/governance.md
new file mode 100644
index 0000000..74dd787
--- /dev/null
+++ b/forum-network/notes/governance.md
@@ -0,0 +1 @@
+Each DAO needs to allocate some of its incoming fees to incentivize development.
diff --git a/forum-network/src/classes/actors/expert.js b/forum-network/src/classes/actors/expert.js
index b8ecda0..69a1d7c 100644
--- a/forum-network/src/classes/actors/expert.js
+++ b/forum-network/src/classes/actors/expert.js
@@ -1,7 +1,7 @@
import { Action } from '../display/action.js';
import { PostMessage } from '../forum-network/message.js';
import { CryptoUtil } from '../util/crypto.js';
-import { ReputationHolder } from './reputation-holder.js';
+import { ReputationHolder } from '../reputation/reputation-holder.js';
export class Expert extends ReputationHolder {
constructor(dao, name, scene) {
@@ -47,7 +47,7 @@ export class Expert extends ReputationHolder {
}
async initiateValidationPool(poolOptions) {
- // For now, directly call bench.initiateValidationPool();
+ // For now, make direct call rather than network
poolOptions.reputationPublicKey = this.reputationPublicKey;
const pool = await this.dao.initiateValidationPool(poolOptions);
this.tokens.push(pool.tokenId);
diff --git a/forum-network/src/classes/actors/post.js b/forum-network/src/classes/actors/post.js
deleted file mode 100644
index a214c6d..0000000
--- a/forum-network/src/classes/actors/post.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import { Actor } from '../display/actor.js';
-import { displayNumber } from '../../util.js';
-import params from '../../params.js';
-
-export class Post extends Actor {
- constructor(forum, authorPublicKey, postContent) {
- const index = forum.posts.countVertices();
- const name = `Post${index + 1}`;
- super(name, forum.scene);
- this.id = postContent.id ?? name;
- this.authorPublicKey = authorPublicKey;
- this.value = 0;
- this.initialValue = 0;
- this.citations = postContent.citations;
- this.title = postContent.title;
- const leachingTotal = this.citations
- .filter(({ weight }) => weight < 0)
- .reduce((total, { weight }) => total += -weight, 0);
- const donationTotal = this.citations
- .filter(({ weight }) => weight > 0)
- .reduce((total, { weight }) => total += weight, 0);
- if (leachingTotal > params.revaluationLimit) {
- throw new Error('Post leaching total exceeds revaluation limit '
- + `(${leachingTotal} > ${params.revaluationLimit})`);
- }
- if (donationTotal > params.revaluationLimit) {
- throw new Error('Post donation total exceeds revaluation limit '
- + `(${donationTotal} > ${params.revaluationLimit})`);
- }
- if (this.citations.some(({ weight }) => Math.abs(weight) > params.revaluationLimit)) {
- throw new Error(`Each citation magnitude must not exceed revaluation limit ${params.revaluationLimit}`);
- }
- }
-
- getLabel() {
- return `${this.name}
-
- initial |
- ${displayNumber(this.initialValue)} |
-
- value |
- ${displayNumber(this.value)} |
-
`
- .replaceAll(/\n\s*/g, '');
- }
-}
diff --git a/forum-network/src/classes/actors/availability.js b/forum-network/src/classes/dao/availability.js
similarity index 100%
rename from forum-network/src/classes/actors/availability.js
rename to forum-network/src/classes/dao/availability.js
diff --git a/forum-network/src/classes/actors/business.js b/forum-network/src/classes/dao/business.js
similarity index 100%
rename from forum-network/src/classes/actors/business.js
rename to forum-network/src/classes/dao/business.js
diff --git a/forum-network/src/classes/actors/dao.js b/forum-network/src/classes/dao/dao.js
similarity index 90%
rename from forum-network/src/classes/actors/dao.js
rename to forum-network/src/classes/dao/dao.js
index ee6f6a3..938d019 100644
--- a/forum-network/src/classes/actors/dao.js
+++ b/forum-network/src/classes/dao/dao.js
@@ -1,6 +1,6 @@
import params from '../../params.js';
import { Forum } from './forum.js';
-import { ReputationTokenContract } from '../contracts/reputation-token.js';
+import { ReputationTokenContract } from '../reputation/reputation-token.js';
import { ValidationPool } from './validation-pool.js';
import { Availability } from './availability.js';
import { Business } from './business.js';
@@ -72,9 +72,4 @@ export class DAO extends Actor {
return pool;
}
-
- async submitPost(reputationPublicKey, postContent) {
- const post = await this.forum.addPost(reputationPublicKey, postContent);
- return post.id;
- }
}
diff --git a/forum-network/src/classes/actors/forum.js b/forum-network/src/classes/dao/forum.js
similarity index 79%
rename from forum-network/src/classes/actors/forum.js
rename to forum-network/src/classes/dao/forum.js
index 41ae511..6a6db0f 100644
--- a/forum-network/src/classes/actors/forum.js
+++ b/forum-network/src/classes/dao/forum.js
@@ -1,13 +1,56 @@
import { WDAG } from '../supporting/wdag.js';
import { Action } from '../display/action.js';
+import { Actor } from '../display/actor.js';
import params from '../../params.js';
-import { ReputationHolder } from './reputation-holder.js';
+import { ReputationHolder } from '../reputation/reputation-holder.js';
import { displayNumber, EPSILON } from '../../util.js';
-import { Post } from './post.js';
const CITATION = 'citation';
const BALANCE = 'balance';
+class Post extends Actor {
+ constructor(forum, authorPublicKey, postContent) {
+ const index = forum.posts.countVertices();
+ const name = `Post${index + 1}`;
+ super(name, forum.scene);
+ this.id = postContent.id ?? name;
+ this.authorPublicKey = authorPublicKey;
+ this.value = 0;
+ this.initialValue = 0;
+ this.citations = postContent.citations;
+ this.title = postContent.title;
+ const leachingTotal = this.citations
+ .filter(({ weight }) => weight < 0)
+ .reduce((total, { weight }) => total += -weight, 0);
+ const donationTotal = this.citations
+ .filter(({ weight }) => weight > 0)
+ .reduce((total, { weight }) => total += weight, 0);
+ if (leachingTotal > params.revaluationLimit) {
+ throw new Error('Post leaching total exceeds revaluation limit '
+ + `(${leachingTotal} > ${params.revaluationLimit})`);
+ }
+ if (donationTotal > params.revaluationLimit) {
+ throw new Error('Post donation total exceeds revaluation limit '
+ + `(${donationTotal} > ${params.revaluationLimit})`);
+ }
+ if (this.citations.some(({ weight }) => Math.abs(weight) > params.revaluationLimit)) {
+ throw new Error(`Each citation magnitude must not exceed revaluation limit ${params.revaluationLimit}`);
+ }
+ }
+
+ getLabel() {
+ return `${this.name}
+
+ initial |
+ ${displayNumber(this.initialValue)} |
+
+ value |
+ ${displayNumber(this.value)} |
+
`
+ .replaceAll(/\n\s*/g, '');
+ }
+}
+
/**
* Purpose:
* - Forum: Maintain a directed, acyclic, graph of positively and negatively weighted citations.
diff --git a/forum-network/src/classes/actors/validation-pool.js b/forum-network/src/classes/dao/validation-pool.js
similarity index 99%
rename from forum-network/src/classes/actors/validation-pool.js
rename to forum-network/src/classes/dao/validation-pool.js
index 5accbf6..4781608 100644
--- a/forum-network/src/classes/actors/validation-pool.js
+++ b/forum-network/src/classes/dao/validation-pool.js
@@ -1,4 +1,4 @@
-import { ReputationHolder } from './reputation-holder.js';
+import { ReputationHolder } from '../reputation/reputation-holder.js';
import { Stake } from '../supporting/stake.js';
import { Voter } from '../supporting/voter.js';
import params from '../../params.js';
diff --git a/forum-network/src/classes/display/table.js b/forum-network/src/classes/display/table.js
index 10dbd0b..ee579d4 100644
--- a/forum-network/src/classes/display/table.js
+++ b/forum-network/src/classes/display/table.js
@@ -42,4 +42,8 @@ export class Table {
cell.innerHTML = typeof value === 'number' ? displayNumber(value) : value ?? '';
}
}
+
+ listUniqueValueKeys() {
+ return this.columns; // TODO
+ }
}
diff --git a/forum-network/src/classes/forum-network/forum-node.js b/forum-network/src/classes/forum-network/forum-node.js
index f36032e..49ae7c5 100644
--- a/forum-network/src/classes/forum-network/forum-node.js
+++ b/forum-network/src/classes/forum-network/forum-node.js
@@ -4,7 +4,7 @@ import {
} from './message.js';
import { ForumView } from './forum-view.js';
import { NetworkNode } from './network-node.js';
-import { randomID } from '../../util.js';
+import { randomID } from '../util/util.js';
export class ForumNode extends NetworkNode {
constructor(name, scene) {
diff --git a/forum-network/src/classes/ideas/exchange.js b/forum-network/src/classes/ideas/exchange.js
index e69de29..2c1021f 100644
--- a/forum-network/src/classes/ideas/exchange.js
+++ b/forum-network/src/classes/ideas/exchange.js
@@ -0,0 +1,45 @@
+import { DAO } from '../actors/dao.js';
+/**
+ * An Exchange provides conversion between currencies / facilitates such.
+ * That means they carry some of the risk of managing these transactions.
+ *
+ */
+
+class Offer {
+ constructor({
+ _fromType, _toType, _amount, price,
+ }) {
+ this.price = price;
+ // const from =
+ }
+}
+
+export class Exchange extends DAO {
+ constructor(name, scene) {
+ super(name, scene);
+ this.offersByType = new Map(); // >
+ }
+
+ getOffers(offerType) {
+ return this.buyOffersByType.get(offerType) ?? new Map(); // <
+ }
+
+ addOffer(offerOptions) {
+ const offer = new Offer(offerOptions);
+ const { fromType, toType } = offer;
+ [fromType, toType].forEach((type) => {
+ this.offersByType.s();
+ });
+ }
+
+ requestTransaction({
+ fromType, toType, amount, price,
+ }) {
+ // this.
+ }
+
+ buy(fromType, toType, _priceParameters) {
+ const buyOffer = {
+ };
+ }
+}
diff --git a/forum-network/src/classes/ideas/finance.js b/forum-network/src/classes/ideas/finance.js
index 0ca5f53..07e7531 100644
--- a/forum-network/src/classes/ideas/finance.js
+++ b/forum-network/src/classes/ideas/finance.js
@@ -1,10 +1,6 @@
-export class Token {
- constructor(ownerPublicKey) {
- this.ownerPublicKey = ownerPublicKey;
- }
+/**
+ * Finance does the work of analysis of the dynamics of reputation and currency exchange
+ */
- transfer(newOwnerPublicKey) {
- // TODO: Current owner must sign this request
- this.ownerPublicKey = newOwnerPublicKey;
- }
+export class Finance {
}
diff --git a/forum-network/src/classes/ideas/storage.js b/forum-network/src/classes/ideas/storage.js
index e69de29..e317264 100644
--- a/forum-network/src/classes/ideas/storage.js
+++ b/forum-network/src/classes/ideas/storage.js
@@ -0,0 +1,24 @@
+import { randomID } from '../util/util.js';
+
+class Pledge {
+ constructor({ stake, duration }) {
+ this.stake = stake;
+ this.duration = duration;
+ }
+}
+
+/**
+ * Storage work is providing data availability and integrity.
+ * It probably makes sense to manage it in pledges of finite duration.
+ */
+export class Storage {
+ constructor() {
+ this.pledges = new Map();
+ }
+
+ pledge(pledgeOptions) {
+ const id = randomID();
+ this.pledge.set(id, new Pledge(pledgeOptions));
+ return id;
+ }
+}
diff --git a/forum-network/src/classes/actors/reputation-holder.js b/forum-network/src/classes/reputation/reputation-holder.js
similarity index 100%
rename from forum-network/src/classes/actors/reputation-holder.js
rename to forum-network/src/classes/reputation/reputation-holder.js
diff --git a/forum-network/src/classes/contracts/reputation-token.js b/forum-network/src/classes/reputation/reputation-token.js
similarity index 98%
rename from forum-network/src/classes/contracts/reputation-token.js
rename to forum-network/src/classes/reputation/reputation-token.js
index c39af4d..c4fec73 100644
--- a/forum-network/src/classes/contracts/reputation-token.js
+++ b/forum-network/src/classes/reputation/reputation-token.js
@@ -1,4 +1,4 @@
-import { ERC721 } from './erc721.js';
+import { ERC721 } from '../supporting/erc721.js';
import { EPSILON, randomID } from '../../util.js';
diff --git a/forum-network/src/classes/contracts/erc20.js b/forum-network/src/classes/supporting/erc20.js
similarity index 100%
rename from forum-network/src/classes/contracts/erc20.js
rename to forum-network/src/classes/supporting/erc20.js
diff --git a/forum-network/src/classes/contracts/erc721.js b/forum-network/src/classes/supporting/erc721.js
similarity index 100%
rename from forum-network/src/classes/contracts/erc721.js
rename to forum-network/src/classes/supporting/erc721.js
diff --git a/forum-network/src/tests/business.test.html b/forum-network/src/tests/business.test.html
index 03644c7..9a117eb 100644
--- a/forum-network/src/tests/business.test.html
+++ b/forum-network/src/tests/business.test.html
@@ -15,8 +15,12 @@
-
-
+
+
-
-
+
+