25 lines
509 B
JavaScript
25 lines
509 B
JavaScript
import { randomID } from '../util/util/helpers.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;
|
|
}
|
|
}
|