Skip to content

Commit de598be

Browse files
committed
ref!: rename 'collateral' to 'burn' to avoid confusion
1 parent b7a6419 commit de598be

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

bin/gobject-prepare.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function main() {
2121
console.info("");
2222
console.info("USAGE");
2323
console.info(
24-
" dashgov draft-proposal [start period] [num periods] <DASH-per-period> <proposal-url> <name> <payment-addr> <./collateral-key.wif> [network]",
24+
" dashgov draft-proposal [start period] [num periods] <DASH-per-period> <proposal-url> <name> <payment-addr> <./burn-key.wif> [network]",
2525
);
2626
console.info("");
2727
console.info("EXAMPLE");
@@ -43,11 +43,11 @@ async function main() {
4343
let proposalUrl = process.argv[5] || "";
4444
let proposalName = process.argv[6] || "";
4545
let paymentAddr = process.argv[7] || "";
46-
let collateralWifPath = process.argv[8] || "";
47-
let collateralWif = "";
48-
if (collateralWifPath) {
49-
collateralWif = await Fs.readFile(collateralWifPath, "utf8");
50-
collateralWif = collateralWif.trim();
46+
let burnWifPath = process.argv[8] || "";
47+
let burnWif = "";
48+
if (burnWifPath) {
49+
burnWif = await Fs.readFile(burnWifPath, "utf8");
50+
burnWif = burnWif.trim();
5151
}
5252

5353
let rpcConfig = {
@@ -251,22 +251,22 @@ async function main() {
251251
let gobj = DashGov.proposal.draft(now, selected.start.startMs, gobjData, {});
252252
console.log(gobj);
253253

254-
let gobjCollateralBytes = DashGov.serializeForCollateralTx(gobj);
255-
let gobjCollateralHex = DashGov.utils.bytesToHex(gobjCollateralBytes);
254+
let gobjBurnBytes = DashGov.serializeForBurnTx(gobj);
255+
let gobjBurnHex = DashGov.utils.bytesToHex(gobjBurnBytes);
256256

257-
let gobjHashBytes = await DashGov.utils.doubleSha256(gobjCollateralBytes);
257+
let gobjHashBytes = await DashGov.utils.doubleSha256(gobjBurnBytes);
258258
let gobjId = DashGov.utils.hashToId(gobjHashBytes);
259259

260260
let gobjHashBytesReverse = gobjHashBytes.slice();
261261
gobjHashBytesReverse = gobjHashBytesReverse.reverse();
262262
let gobjIdForward = DashGov.utils.hashToId(gobjHashBytesReverse);
263263

264264
console.log("");
265-
console.log("GObject Serialization (for hash for collateral memo)");
266-
console.log(gobjCollateralHex);
265+
console.log("GObject Serialization (for hash for burn memo)");
266+
console.log(gobjBurnHex);
267267

268268
console.log("");
269-
console.log("(Collateralized) GObject ID (for op return memo)");
269+
console.log("(Burnable) GObject ID (for op return memo)");
270270
console.log(gobjIdForward);
271271
console.log("GObject ID (for 'gobject get <gobj-id>')");
272272
console.log(gobjId);
@@ -277,7 +277,7 @@ async function main() {
277277
* @param {Number} i
278278
*/
279279
getPrivateKey: async function (txInput, i) {
280-
return DashKeys.wifToPrivKey(collateralWif, { version: network });
280+
return DashKeys.wifToPrivKey(burnWif, { version: network });
281281
},
282282

283283
/**
@@ -316,19 +316,19 @@ async function main() {
316316
let dashTx = DashTx.create(keyUtils);
317317

318318
// dash-cli -testnet getaddressutxos '{"addresses":["yT6GS8qPrhsiiLHEaTWPYJMwfPPVt2SSFC"]}'
319-
let collateralAddr = await DashKeys.wifToAddr(collateralWif, {
319+
let burnAddr = await DashKeys.wifToAddr(burnWif, {
320320
version: network,
321321
});
322322

323323
console.log("");
324-
console.log("Collateral Address (source of 1 DASH network fee):");
325-
console.log(collateralAddr);
324+
console.log("Burn Address (source of 1 DASH network fee):");
325+
console.log(burnAddr);
326326

327327
let txid = "";
328328
let txInfoSigned;
329329
{
330330
let utxosResult = await rpc.getaddressutxos({
331-
addresses: [collateralAddr],
331+
addresses: [burnAddr],
332332
});
333333
// TODO make sure there's just 1
334334
// @type {Array<DashTx.TxInput>} */
@@ -342,11 +342,11 @@ async function main() {
342342
//
343343

344344
console.log("");
345-
console.log("Signed Collateral Transaction (ready for broadcast):");
345+
console.log("Signed Burn Transaction (ready for broadcast):");
346346
console.log(txInfoSigned.transaction);
347347

348348
console.log("");
349-
console.log("Signed Collateral Transaction ID:");
349+
console.log("Signed Burn Transaction ID:");
350350
txid = await DashTx.getId(txInfoSigned.transaction);
351351
console.log(txid);
352352
}
@@ -443,7 +443,7 @@ async function main() {
443443
// @ts-ignore - code exists
444444
let code = err.code;
445445
if (code === E_INVALID_COLLATERAL) {
446-
// wait for collateral to become valid
446+
// wait for burn to become valid
447447
console.error(code, err.message);
448448
return null;
449449
}

dashgov.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function writeVarInt(dv, offset, n) {
185185
/**
186186
* @param {GObject} gobj
187187
*/
188-
DashGov.serializeForCollateralTx = function ({
188+
DashGov.serializeForBurnTx = function ({
189189
hashParent = 0,
190190
revision = 1,
191191
time,

tests/gobject-propose-txid.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ async function main() {
3030
let knownHash =
3131
"257eae59b294bb60857019674c4fd7e822d6bf0f58150f340cc8e6c273d0f2a9";
3232

33-
let gobjCollateralBytes = GObj.serializeForCollateralTx(gobj);
33+
let gobjBurnBytes = GObj.serializeForBurnTx(gobj);
3434

3535
if (1 === 1) {
36-
const hex_bytes = GObj.utils.bytesToHex(gobjCollateralBytes);
36+
const hex_bytes = GObj.utils.bytesToHex(gobjBurnBytes);
3737

3838
const data = [
3939
["hashParent", 32],
@@ -63,7 +63,7 @@ async function main() {
6363

6464
let hashBytes;
6565
{
66-
let hash1 = await crypto.subtle.digest("SHA-256", gobjCollateralBytes);
66+
let hash1 = await crypto.subtle.digest("SHA-256", gobjBurnBytes);
6767
let hash2 = await crypto.subtle.digest("SHA-256", hash1);
6868

6969
let hash1Bytes = new Uint8Array(hash1);

0 commit comments

Comments
 (0)