Skip to content

Commit aa0597a

Browse files
authored
Merge pull request #26 from ProvableHQ/IGI-111/unified-fn-examples
Change examples to use unified fn syntax
2 parents cf3274e + 601b588 commit aa0597a

80 files changed

Lines changed: 2530 additions & 1960 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

auction/build/abi.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
],
4343
"mappings": [],
4444
"storage_variables": [],
45-
"transitions": [
45+
"functions": [
4646
{
4747
"name": "place_bid",
48-
"is_async": false,
48+
"is_final": false,
4949
"inputs": [
5050
{
5151
"name": "bidder",
@@ -75,7 +75,7 @@
7575
"path": [
7676
"Bid"
7777
],
78-
"program": "auction"
78+
"program": "auction.aleo"
7979
}
8080
},
8181
"mode": "None"
@@ -84,7 +84,7 @@
8484
},
8585
{
8686
"name": "resolve",
87-
"is_async": false,
87+
"is_final": false,
8888
"inputs": [
8989
{
9090
"name": "first",
@@ -93,7 +93,7 @@
9393
"path": [
9494
"Bid"
9595
],
96-
"program": "auction"
96+
"program": "auction.aleo"
9797
}
9898
},
9999
"mode": "None"
@@ -105,7 +105,7 @@
105105
"path": [
106106
"Bid"
107107
],
108-
"program": "auction"
108+
"program": "auction.aleo"
109109
}
110110
},
111111
"mode": "None"
@@ -118,7 +118,7 @@
118118
"path": [
119119
"Bid"
120120
],
121-
"program": "auction"
121+
"program": "auction.aleo"
122122
}
123123
},
124124
"mode": "None"
@@ -127,7 +127,7 @@
127127
},
128128
{
129129
"name": "finish",
130-
"is_async": false,
130+
"is_final": false,
131131
"inputs": [
132132
{
133133
"name": "bid",
@@ -136,7 +136,7 @@
136136
"path": [
137137
"Bid"
138138
],
139-
"program": "auction"
139+
"program": "auction.aleo"
140140
}
141141
},
142142
"mode": "None"
@@ -149,7 +149,7 @@
149149
"path": [
150150
"Bid"
151151
],
152-
"program": "auction"
152+
"program": "auction.aleo"
153153
}
154154
},
155155
"mode": "None"

auction/src/main.leo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ program auction.aleo {
1818
// Requires that `bidder` matches the function caller.
1919
// The owner of the record is set to the entity responsible for running the auction (auction runner).
2020
// The address of the auction runner is aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg.
21-
transition place_bid(bidder: address, amount: u64) -> Bid {
21+
fn place_bid(bidder: address, amount: u64) -> Bid {
2222
// Ensure the caller is the auction bidder.
2323
assert_eq(self.caller, bidder);
2424
// Return a new 'Bid' record for the auction bidder.
@@ -36,7 +36,7 @@ program auction.aleo {
3636
// Requires that the function caller is the auction runner.
3737
// Assumes that the function is invoked only after the bidding period has ended.
3838
// In the event of a tie, the first bid is selected.
39-
transition resolve(first: Bid, second: Bid) -> Bid {
39+
fn resolve(first: Bid, second: Bid) -> Bid {
4040
// Ensure the caller is the auctioneer.
4141
assert_eq(self.caller, aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg);
4242
// Resolve the winner of the auction.
@@ -51,7 +51,7 @@ program auction.aleo {
5151
// - `bid` : The winning bid.
5252
// Requires that the function caller is the auction runner.
5353
// Assumes that the function is invoked only after all bids have been resolved.
54-
transition finish(bid: Bid) -> Bid {
54+
fn finish(bid: Bid) -> Bid {
5555
// Ensure the caller is the auctioneer.
5656
assert_eq(self.caller, aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg);
5757
// Return 'is_winner' as 'true' in the winning 'Bid'.
@@ -65,6 +65,6 @@ program auction.aleo {
6565

6666
// The constructor is configured to prevent upgrades.
6767
@noupgrade
68-
async constructor() {}
68+
constructor() {}
6969
}
7070

basic_bank/build/abi.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
}
4141
],
4242
"storage_variables": [],
43-
"transitions": [
43+
"functions": [
4444
{
4545
"name": "issue",
46-
"is_async": false,
46+
"is_final": false,
4747
"inputs": [
4848
{
4949
"name": "owner",
@@ -73,7 +73,7 @@
7373
"path": [
7474
"Token"
7575
],
76-
"program": "basic_bank"
76+
"program": "basic_bank.aleo"
7777
}
7878
},
7979
"mode": "None"
@@ -82,7 +82,7 @@
8282
},
8383
{
8484
"name": "deposit",
85-
"is_async": true,
85+
"is_final": true,
8686
"inputs": [
8787
{
8888
"name": "token",
@@ -91,7 +91,7 @@
9191
"path": [
9292
"Token"
9393
],
94-
"program": "basic_bank"
94+
"program": "basic_bank.aleo"
9595
}
9696
},
9797
"mode": "None"
@@ -115,20 +115,20 @@
115115
"path": [
116116
"Token"
117117
],
118-
"program": "basic_bank"
118+
"program": "basic_bank.aleo"
119119
}
120120
},
121121
"mode": "None"
122122
},
123123
{
124-
"ty": "Future",
124+
"ty": "Final",
125125
"mode": "None"
126126
}
127127
]
128128
},
129129
{
130130
"name": "withdraw",
131-
"is_async": true,
131+
"is_final": true,
132132
"inputs": [
133133
{
134134
"name": "recipient",
@@ -180,13 +180,13 @@
180180
"path": [
181181
"Token"
182182
],
183-
"program": "basic_bank"
183+
"program": "basic_bank.aleo"
184184
}
185185
},
186186
"mode": "None"
187187
},
188188
{
189-
"ty": "Future",
189+
"ty": "Final",
190190
"mode": "None"
191191
}
192192
]

0 commit comments

Comments
 (0)