Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions blind-auction/.project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"fullNodeVersion": "v2.11.0",
"fullNodeVersion": "v2.14.0",
"compilerOptionsUsed": {
"ignoreUnusedConstantsWarnings": false,
"ignoreUnusedVariablesWarnings": false,
Expand All @@ -11,9 +11,9 @@
"infos": {
"Auction": {
"sourceFile": "auction.ral",
"sourceCodeHash": "edd297cccd161583f5ac317d8683d1dbce2e690e0a53b11f88db89686b83d8b7",
"bytecodeDebugPatch": "=6-1+b=3-1+3=3-1+5=3-1+8=3-1+b=14-1+6=83-1+e=40+7a037e0300012c00=134+7a037e0300012c00=91-1+c=167-1+5=56-2+70=225-1+d=138+7a047e0300012c00=51-1+7=21-1+c=40+7a047e0300012c00=270",
"codeHashDebug": "1356fae06f4830022d51691f7dc97f92514a3d108cab3722e985a29aaf405af0",
"sourceCodeHash": "712973ad0914c8721120b9e304c6fc9a86777da230bea04135f80657058db25c",
"bytecodeDebugPatch": "=6-6+e6=2-1=1+7=2-2+ac=2-2+e5431a=13-1+5=93-1+d=40+7a7e0214696e73657274206174206d617020706174683a2000=134+7a7e0214696e73657274206174206d617020706174683a2000=91-1+b=177-1+4=57-1+f=225-1+c=138+7a7e021472656d6f7665206174206d617020706174683a2000=51-1+8=21-1+b=40+7a7e021472656d6f7665206174206d617020706174683a2000=300",
"codeHashDebug": "648a2196562521f62c79c87ba5aa4461bcc1c38b06ff97a929977faf712cf8b2",
"warnings": []
},
"AuctionEnd": {
Expand All @@ -25,7 +25,7 @@
},
"Bid": {
"sourceFile": "auction.ral",
"sourceCodeHash": "edd297cccd161583f5ac317d8683d1dbce2e690e0a53b11f88db89686b83d8b7",
"sourceCodeHash": "712973ad0914c8721120b9e304c6fc9a86777da230bea04135f80657058db25c",
"bytecodeDebugPatch": "",
"codeHashDebug": "",
"warnings": []
Expand Down
6 changes: 3 additions & 3 deletions blind-auction/artifacts/Auction.ral.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "v2.11.0",
"version": "v2.14.0",
"name": "Auction",
"bytecode": "060540af42194239426d429d0101030700405016014313202f0c7b56ce01320d7b1600480e7b0c1703140a5f5f6d61705f5f315f5f16004744cbc54b0b1600d1a2140a5f5f6d61705f5f315f5f16004744b10cd201014a0a0c0d0d140a5f5f6d61705f5f315f5f16004744cb0101170316004716034044170416011602170617051600d1a2140a5f5f6d61705f5f305f5f16044416051606b1d2030016030d2a0c0e0c140a5f5f6d61705f5f315f5f16004744cb010216001602a9010104100040c656ce01330f7b56ce0232107b0c0d0d140a5f5f6d61705f5f315f5f16004744cb0101170416014313202d16042f0c7b16024316042f0c7b16034313202d16042f0c7b0c1705160417060c170716071604314c4082160047160740441708140a5f5f6d61705f5f305f5f160844cbc54c406d1601160713202c16070d2a13202c627117091602160716070d2a62170a160a140100414c02044a0103170b1603160713202c16070d2a13202c62170c0c0d0d140a5f5f6d61705f5f305f5f160844cb170f160f01000d0d0d160f0100170e170d160d16096b160b1e44160c444e414c402a1605160e2a1705160b19160e1609341a1609a002331a4c0fa001ca464c03a001a002a81609a1021600a101160516092b170516000d0c140a5f5f6d61705f5f305f5f160844cb010316060d2b17064a0416060d2b170616070d2a17074a7f7a16001605a816060c2f4c0916000d0c140a5f5f6d61705f5f315f5f16004744cb010301020000001256ce0233117ba0001913067b05a001a0025f03a100ce00a002a8010001010113140a5f5f6d61705f5f315f5f16004744cbc54c0a0c0d0d140a5f5f6d61705f5f315f5f16004744cb01014a010c020100020502161600471601404417020c0d0d140a5f5f6d61705f5f305f5f160244cb1703160301000d0d0d1603010002",
"codeHash": "199d24a973b0bca6f5cf11d9b767774a13835b6e0142ffa443ebf910111f83a8",
"bytecode": "060540b442234248428142b601010307004051d36e22cd6316014313202f0c7b56ce01320d7b1600480e7b0c1703140a5f5f6d61705f5f315f5f16004744cbc54b0b1600d1a2140a5f5f6d61705f5f315f5f16004744b10cd201014a0a0c0d0d140a5f5f6d61705f5f315f5f16004744cb0101170316004716034044170416011602170617051600d1a2140a5f5f6d61705f5f305f5f16044416051606b1d2030016030d2a0c0e0c140a5f5f6d61705f5f315f5f16004744cb010216001602a9010104100040c7d3d76fe3f156ce01330f7b56ce0232107b0c0d0d140a5f5f6d61705f5f315f5f16004744cb0101170416014313202d16042f0c7b16024316042f0c7b16034313202d16042f0c7b0c1705160417060c170716071604314c4082160047160740441708140a5f5f6d61705f5f305f5f160844cbc54c406d1601160713202c16070d2a13202c627117091602160716070d2a62170a160a140100414c02044a0103170b1603160713202c16070d2a13202c62170c0c0d0d140a5f5f6d61705f5f305f5f160844cb170f160f01000d0d0d160f0100170e170d160d16096b160b1e44160c444e414c402a1605160e2a1705160b19160e1609341a1609a002331a4c0fa001ca464c03a001a002a81609a1021600a101160516092b170516000d0c140a5f5f6d61705f5f305f5f160844cb010316060d2b17064a0416060d2b170616070d2a17074a7f7a16001605a816060c2f4c0916000d0c140a5f5f6d61705f5f315f5f16004744cb0103010200000013d3ddea839c56ce0233117ba0001913067b05a001a0025f03a100ce00a002a8010001010114d337254ea9140a5f5f6d61705f5f315f5f16004744cbc54c0a0c0d0d140a5f5f6d61705f5f315f5f16004744cb01014a010c02010002050217d3c67c31f51600471601404417020c0d0d140a5f5f6d61705f5f305f5f160244cb1703160301000d0d0d1603010002",
"codeHash": "6f8e91b9d65aa9896d17ce7f311a4e1bc455fcb4499234a6b6e9b963e41537bd",
"fieldsSig": {
"names": [
"beneficiary",
Expand Down
2 changes: 1 addition & 1 deletion blind-auction/artifacts/AuctionEnd.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v2.11.0",
"version": "v2.14.0",
"name": "AuctionEnd",
"bytecodeTemplate": "010103000000040c0c{0}0102",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion blind-auction/artifacts/NewBid.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v2.11.0",
"version": "v2.14.0",
"name": "NewBid",
"bytecodeTemplate": "0101030000000eb4{2}d10e2c2aa2b4{1}{2}0f0c{0}0100",
"fieldsSig": {
Expand Down
2 changes: 1 addition & 1 deletion blind-auction/artifacts/Reveal.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v2.11.0",
"version": "v2.14.0",
"name": "Reveal",
"bytecodeTemplate": "0101030000000bb4d1a2b4{1}{2}{3}100c{0}0101",
"fieldsSig": {
Expand Down
14 changes: 12 additions & 2 deletions blind-auction/artifacts/ts/Auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
getContractEventsCurrentCount,
TestContractParamsWithoutMaps,
TestContractResultWithoutMaps,
addStdIdToFields,
encodeContractFields,
} from "@alephium/web3";
import { default as AuctionContractJson } from "../Auction.ral.json";
import { getContractByCodeHash } from "./contracts";
Expand Down Expand Up @@ -73,6 +75,14 @@ export namespace AuctionTypes {
}

class Factory extends ContractFactory<AuctionInstance, AuctionTypes.Fields> {
encodeFields(fields: AuctionTypes.Fields) {
return encodeContractFields(
addStdIdToFields(this.contract, fields),
this.contract.fieldsSig,
AllStructs
);
}

getInitialFieldsWithDefaultValues() {
return this.contract.getInitialFieldsWithDefaultValues() as AuctionTypes.Fields;
}
Expand Down Expand Up @@ -180,8 +190,8 @@ class Factory extends ContractFactory<AuctionInstance, AuctionTypes.Fields> {
export const Auction = new Factory(
Contract.fromJson(
AuctionContractJson,
"=6-1+b=3-1+3=3-1+5=3-1+8=3-1+b=14-1+6=83-1+e=40+7a037e0300012c00=134+7a037e0300012c00=91-1+c=167-1+5=56-2+70=225-1+d=138+7a047e0300012c00=51-1+7=21-1+c=40+7a047e0300012c00=270",
"1356fae06f4830022d51691f7dc97f92514a3d108cab3722e985a29aaf405af0",
"=6-6+e6=2-1=1+7=2-2+ac=2-2+e5431a=13-1+5=93-1+d=40+7a7e0214696e73657274206174206d617020706174683a2000=134+7a7e0214696e73657274206174206d617020706174683a2000=91-1+b=177-1+4=57-1+f=225-1+c=138+7a7e021472656d6f7665206174206d617020706174683a2000=51-1+8=21-1+b=40+7a7e021472656d6f7665206174206d617020706174683a2000=300",
"648a2196562521f62c79c87ba5aa4461bcc1c38b06ff97a929977faf712cf8b2",
AllStructs
)
);
Expand Down
6 changes: 3 additions & 3 deletions blind-auction/contracts/auction.ral
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Contract Auction(

let mut count = 0
if (!bidNum.contains!(bidder)) {
bidNum.insert!{bidder -> ALPH: mapEntryDeposit!()}(bidder, 0)
bidNum.insert!(bidder, bidder, 0)
} else {
count = bidNum[bidder]
}

let bidKey = toByteVec!(bidder) ++ toByteVec!(count)
let newBid = Bid { blindedBid: blindedBid, deposit: deposit }
bids.insert!{bidder -> ALPH: mapEntryDeposit!()}(bidKey, newBid)
bids.insert!(bidder, bidKey, newBid)
bidNum[bidder] = count + 1
transferTokenToSelf!(bidder, ALPH, deposit)
}
Expand Down Expand Up @@ -82,7 +82,7 @@ Contract Auction(
highestBidder = bidder
refund = refund - value
}
bids.remove!(bidKey, bidder)
bids.remove!(bidder, bidKey)
remains = remains - 1
}

Expand Down
76 changes: 38 additions & 38 deletions blind-auction/package-lock.json

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

10 changes: 5 additions & 5 deletions blind-auction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"clean:windows": "node -e \"if (process.platform === 'win32') process.exit(1)\" || , if exist dist rmdir /Q /S dist",
"devnet:start": "npx cli devnet start",
"devnet:stop": "npx cli devnet stop",
"compile": "npx cli compile",
"compile": "npx cli compile -n testnet",
"deploy": "npx cli deploy",
"lint": "eslint . --ext ts",
"lint:fix": "eslint . --fix --ext ts",
"test": "jest -i --config ./jest-config.json"
},
"dependencies": {
"@alephium/cli": "0.38.0",
"@alephium/web3": "0.38.0",
"@alephium/web3-test": "0.38.0",
"@alephium/web3-wallet": "0.38.0",
"@alephium/cli": "0.39.3",
"@alephium/web3": "0.39.3",
"@alephium/web3-test": "0.39.3",
"@alephium/web3-wallet": "0.39.3",
"blakejs": "^1.2.1"
},
"devDependencies": {
Expand Down