Skip to content

Commit

Permalink
17.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabcotech committed May 11, 2022
1 parent 970ad5b commit 3a78911
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 67 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
<<<<<<< HEAD
"name": "@fabcotech/rchain-token",
"version": "16.0.2",
=======
"name": "rchain-token",
"version": "17.0.0",
>>>>>>> 280e0d9 (17.0.0)
"description": "Fungibles and non-fungibles tokens on the RChain blockchain",
"main": "src/index.js",
"scripts": {
Expand All @@ -10,7 +15,11 @@
"test:ft": "node tests-ft/index",
"test:nft": "node tests-nft/index",
"test:credit": "node tests-credit/index",
<<<<<<< HEAD
"dappy:namesystem": "node cli deploy --fungible false --contract-id dappynamesystem && node cli create-purse --new-id 0 --quantity 100000000 && node cli update-purse-price --price rev,50000000 --purse-id 0",
=======
"dappy:namesystem": "node cli deploy --fungible false --contract-id dappynamesystem && node cli create-purse --new-id 0 --quantity 100000000 && node cli update-purse-price --price [\\\"prefixrev\\\",50000000] --purse-id 0",
>>>>>>> 280e0d9 (17.0.0)
"dappy:namesystemanddefaults": "npm run dappy:namesystem && node cli create-purse --purses-file name-purses.json"
},
"repository": {
Expand Down
51 changes: 29 additions & 22 deletions rholang/master.rho
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,10 @@ in {
@(*self, "CONTRACT_LOCK", contractId)!(Nil)
} |

logsCh!("HEY 1") |
logsCh!("HEY 2") |
logsCh!("HEY 3") |
logsCh!("HEY 4") |
logsCh!("HEY 5") |

for (@str <= appendLogCh) {
stdout!("appendLogCh") |
new ch1 in {
blockData!(*ch1) |
for (_, @timestamp, _ <- ch1) {
stdout!("logsCh") |
stdout!("${ts},${str}" %% { "ts": timestamp, "str": str }) |
logsCh!("${ts},${str}" %% { "ts": timestamp, "str": str }) |
for (str <- logsCh) { Nil }
}
Expand Down Expand Up @@ -650,6 +641,7 @@ in {
} |

for (@("PUBLIC_DELETE_EXPIRED_PURSE", contractId, boxId, purseId, return) <= entryCh) {
stdout!("PUBLIC_DELETE_EXPIRED_PURSE") |
new ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, proceeedDeleteCh, unlock in {
for (@result <- unlock) {
@(*self, "BOX_LOCK", boxId)!(Nil) |
Expand All @@ -659,6 +651,10 @@ in {
getContractPursesThmCh!((contractId, *ch1)) |
getBoxCh!((boxId, *ch2)) |
for (@pursesThm <- ch1; @box <- ch2) {
stdout!("pursesThm") |
stdout!(pursesThm) |
stdout!("box") |
stdout!(box) |
if (pursesThm != Nil and box != Nil) {
for (
_ <- @(*self, "CONTRACT_LOCK", contractId);
Expand All @@ -674,18 +670,23 @@ in {
// RACE SAFE / RESOURCES LOCKED
// after lock of 1 contract and 1 box
for (_ <- proceeedDeleteCh) {
stdout!("proceeedDeleteCh") |
getContractPursesThmCh!((contractId, *ch3)) |
getContractPursesDataThmCh!((contractId, *ch4)) |
for (@pursesThm <- ch3; @pursesDataThm <- ch4) {
TreeHashMap!("get", pursesThm, purseId, *ch5) |
for (@purse <- ch5) {
stdout!("purse") |
stdout!(purse) |
if (purse != Nil) {
if (purse.get("boxId") == boxId) {
for (@config <<- @(*self, "contractConfig", contractId)) {
match (config.get("fungible"), purseId == "0", config.get("expires")) {
(false, false, Int) => {
blockData!(*ch6) |
for (_, @timestamp, _ <- ch6) {
stdout!(("timestamp", timestamp)) |
stdout!(("purse.timestamp", purse.get("timestamp"))) |
if (timestamp - purse.get("timestamp") > config.get("expires")) {
TreeHashMap!("set", pursesThm, purse.get("id"), Nil, *ch7) |
TreeHashMap!("set", pursesDataThm, purse.get("id"), Nil, *ch8) |
Expand Down Expand Up @@ -722,7 +723,7 @@ in {
stdout!(payload.get("publicKey")) |
match (payload.get("boxId"), payload.get("revAddress"), payload.get("publicKey")) {
(String, String, String) => {
new ch1, ch2, ch3, ch4, ch5, ch6, ch7, registerBoxUnlock in {
new ch1, ch2, ch3, ch4, ch5, ch6, ch7, logsCh, registerBoxUnlock in {
for (@result <- registerBoxUnlock) {
@(*self, "REGISTER_BOX_LOCK")!(Nil) |
@return!(result)
Expand Down Expand Up @@ -787,7 +788,7 @@ in {

for (@(boxCh, boxId) <= initializeOCAPOnBoxCh) {
for (@("REGISTER_CONTRACT", payload, return) <= @boxCh) {
new registerContract, ch1, ch2, ch3, ch4, ch5, ch6, registerUnlock in {
new registerContract, ch1, ch2, ch3, ch4, ch5, ch6, registerUnlock, logsCh in {
for (@result <- registerUnlock) {
@(*self, "REGISTER_CONTRACT_LOCK")!(Nil) |
@return!(result)
Expand Down Expand Up @@ -841,7 +842,13 @@ in {

// config
@(*self, "contractConfig", contractId)!(
payload.set("contractId", contractId).set("locked", false).set("counter", 1).set("version", VERSION).set("fee", Nil)
payload
.set("contractId", contractId)
.set("locked", false)
.set("counter", 1)
.set("version", VERSION)
.set("fee", Nil)
.set("logsCh", *logsCh)
) |

new superKeyCh in {
Expand Down Expand Up @@ -1466,14 +1473,14 @@ in {
ch12!(payload.get("merge"))
} |

appendLogCh!(
/* appendLogCh!(
"w,${contractId},${toBox},${fromBox},${q}" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
"toBox": payload.get("toBoxId"),
"q": payload.get("quantity"),
}
) |
) | */
for (@merge <- ch12) {
match (
purse.get("quantity") - payload.get("quantity") >= 0,
Expand Down Expand Up @@ -1794,9 +1801,9 @@ in {
}
(true, newPurse) => {
ch41!(Nil) |
unlock!((purseForSale, (true, Nil))) |
stdout!("OK WILL UNLOVKKVK") |
appendLogCh!(
unlock!((purseForSale, (true, Nil)))

/* appendLogCh!(
"s,${contractId},${toBox},${fromBox},${q},${p1},${p2},${p3},${id},${newId};" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
Expand All @@ -1808,7 +1815,7 @@ in {
"id": payload.get("purseId"),
"newId": newPurse.get("id")
}
)
) */
}
} |
// fee reward is here to avoid dead locks issues
Expand Down Expand Up @@ -1884,9 +1891,9 @@ in {
unlock!((purseForSale, "error: CRITICAL could not make purse " ++ makeBuyerPurseResult))
}
(true, newPurse) => {
unlock!((purseForSale, (true, Nil))) |
appendLogCh!(
"s,${contractId}${toBox},${fromBox},${q},${p1},${p2},${p3},${id},${newId};" %% {
unlock!((purseForSale, (true, Nil)))
/* appendLogCh!(
"s,${contractId},${toBox},${fromBox},${q},${p1},${p2},${p3},${id},${newId};" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
"toBox": purseForSale.get("boxId"),
Expand All @@ -1897,7 +1904,7 @@ in {
"newId": newPurse.get("id"),
"id": payload.get("purseId")
}
)
) */
}
}
}
Expand Down
36 changes: 20 additions & 16 deletions rholang/op_delete_expired_purse.rho
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
new basket, entryCh, lookup(`rho:registry:lookup`), stdout(`rho:io:stdout`) in {
lookup!(`rho:id:MASTER_REGISTRY_URI`, *entryCh) |
new
basket,
entryCh,
returnCh,
registryLookup(`rho:registry:lookup`),
stdout(`rho:io:stdout`)
in {
registryLookup!(`rho:id:MASTER_REGISTRY_URI`, *entryCh) |
for(entry <- entryCh) {
new x in {
entry!(("PUBLIC_DELETE_EXPIRED_PURSE", "CONTRACT_ID", "BOX_ID", "PURSE_ID", *x)) |
for (@r <- x) {
match r {
String => {
basket!({ "status": "failed", "message": r }) |
stdout!(("failed", r))
}
_ => {
// OP_PUBLIC_DELETE_EXPIRED_PURSE_COMPLETED_BEGIN
stdout!("completed, expired purses deleted") |
basket!({ "status": "completed" })
// OP_PUBLIC_DELETE_EXPIRED_PURSE_COMPLETED_END
}
entry!(("PUBLIC_DELETE_EXPIRED_PURSE", "CONTRACT_ID", "BOX_ID", "PURSE_ID", *returnCh)) |
for (@r <- returnCh) {
match r {
String => {
basket!({ "status": "failed", "message": r }) |
stdout!(("failed", r))
}
_ => {
// OP_PUBLIC_DELETE_EXPIRED_PURSE_COMPLETED_BEGIN
stdout!("completed, expired purses deleted") |
basket!({ "status": "completed" })
// OP_PUBLIC_DELETE_EXPIRED_PURSE_COMPLETED_END
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions rholang/op_deploy_box.rho
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
new basket,
masterEntryCh,
entryCh,
registerBoxReturnCh,
stdout(`rho:io:stdout`),
deployerId(`rho:rchain:deployerId`),
registryLookup(`rho:registry:lookup`)
in {

registryLookup!(`rho:id:MASTER_REGISTRY_URI`, *masterEntryCh) |
registryLookup!(`rho:id:MASTER_REGISTRY_URI`, *entryCh) |

for (masterEntry <= masterEntryCh) {
masterEntry!(("PUBLIC_REGISTER_BOX", { "boxId": "BOX_ID", "publicKey": "PUBLIC_KEY", "revAddress": "REV_ADDRESS" }, *registerBoxReturnCh)) |
for (entry <- entryCh) {
entry!(("PUBLIC_REGISTER_BOX", { "boxId": "BOX_ID", "publicKey": "PUBLIC_KEY", "revAddress": "REV_ADDRESS" }, *registerBoxReturnCh)) |
for (@r <- registerBoxReturnCh) {
stdout!(r) |
match r {
Expand Down
41 changes: 19 additions & 22 deletions src/masterTerm.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,19 +559,10 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
@(*self, "CONTRACT_LOCK", contractId)!(Nil)
} |
logsCh!("HEY 1") |
logsCh!("HEY 2") |
logsCh!("HEY 3") |
logsCh!("HEY 4") |
logsCh!("HEY 5") |
for (@str <= appendLogCh) {
stdout!("appendLogCh") |
new ch1 in {
blockData!(*ch1) |
for (_, @timestamp, _ <- ch1) {
stdout!("logsCh") |
stdout!("\${ts},\${str}" %% { "ts": timestamp, "str": str }) |
logsCh!("\${ts},\${str}" %% { "ts": timestamp, "str": str }) |
for (str <- logsCh) { Nil }
}
Expand Down Expand Up @@ -1186,7 +1177,7 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
stdout!(payload.get("publicKey")) |
match (payload.get("boxId"), payload.get("revAddress"), payload.get("publicKey")) {
(String, String, String) => {
new ch1, ch2, ch3, ch4, ch5, ch6, ch7, registerBoxUnlock in {
new ch1, ch2, ch3, ch4, ch5, ch6, ch7, logsCh, registerBoxUnlock in {
for (@result <- registerBoxUnlock) {
@(*self, "REGISTER_BOX_LOCK")!(Nil) |
@return!(result)
Expand Down Expand Up @@ -1251,7 +1242,7 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
for (@(boxCh, boxId) <= initializeOCAPOnBoxCh) {
for (@("REGISTER_CONTRACT", payload, return) <= @boxCh) {
new registerContract, ch1, ch2, ch3, ch4, ch5, ch6, registerUnlock in {
new registerContract, ch1, ch2, ch3, ch4, ch5, ch6, registerUnlock, logsCh in {
for (@result <- registerUnlock) {
@(*self, "REGISTER_CONTRACT_LOCK")!(Nil) |
@return!(result)
Expand Down Expand Up @@ -1305,7 +1296,13 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
// config
@(*self, "contractConfig", contractId)!(
payload.set("contractId", contractId).set("locked", false).set("counter", 1).set("version", "17.0.0").set("fee", Nil)
payload
.set("contractId", contractId)
.set("locked", false)
.set("counter", 1)
.set("version", "17.0.0")
.set("fee", Nil)
.set("logsCh", *logsCh)
) |
new superKeyCh in {
Expand Down Expand Up @@ -1930,14 +1927,14 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
ch12!(payload.get("merge"))
} |
appendLogCh!(
/* appendLogCh!(
"w,\${contractId},\${toBox},\${fromBox},\${q}" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
"toBox": payload.get("toBoxId"),
"q": payload.get("quantity"),
}
) |
) | */
for (@merge <- ch12) {
match (
purse.get("quantity") - payload.get("quantity") >= 0,
Expand Down Expand Up @@ -2258,9 +2255,9 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
}
(true, newPurse) => {
ch41!(Nil) |
unlock!((purseForSale, (true, Nil))) |
stdout!("OK WILL UNLOVKKVK") |
appendLogCh!(
unlock!((purseForSale, (true, Nil)))
/* appendLogCh!(
"s,\${contractId},\${toBox},\${fromBox},\${q},\${p1},\${p2},\${p3},\${id},\${newId};" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
Expand All @@ -2272,7 +2269,7 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
"id": payload.get("purseId"),
"newId": newPurse.get("id")
}
)
) */
}
} |
// fee reward is here to avoid dead locks issues
Expand Down Expand Up @@ -2348,9 +2345,9 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
unlock!((purseForSale, "error: CRITICAL could not make purse " ++ makeBuyerPurseResult))
}
(true, newPurse) => {
unlock!((purseForSale, (true, Nil))) |
appendLogCh!(
"s,\${contractId}\${toBox},\${fromBox},\${q},\${p1},\${p2},\${p3},\${id},\${newId};" %% {
unlock!((purseForSale, (true, Nil)))
/* appendLogCh!(
"s,\${contractId},\${toBox},\${fromBox},\${q},\${p1},\${p2},\${p3},\${id},\${newId};" %% {
"contractId": payload.get("contractId"),
"fromBox": boxId,
"toBox": purseForSale.get("boxId"),
Expand All @@ -2361,7 +2358,7 @@ new MakeNode, ByteArrayToNybbleList, TreeHashMapSetter, TreeHashMapGetter, TreeH
"newId": newPurse.get("id"),
"id": payload.get("purseId")
}
)
) */
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests-ft/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ const main = async () => {

await updatePurseData(
PRIVATE_KEY_2,
PUBLIC_KEY_2,
masterRegistryUri,
boxId2,
contractId,
Expand All @@ -320,7 +319,6 @@ const main = async () => {

await updatePursePrice(
PRIVATE_KEY_2,
PUBLIC_KEY_2,
masterRegistryUri,
boxId2,
contractId,
Expand Down
Loading

0 comments on commit 3a78911

Please sign in to comment.