Skip to content

Commit 7b0ef5d

Browse files
author
hicetnunc2000
committed
delphi
1 parent 544de64 commit 7b0ef5d

File tree

3 files changed

+69
-32
lines changed

3 files changed

+69
-32
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
hicetnuncDAO smart contracts
22

3-
hicetnunc protocol: https://better-call.dev/mainnet/KT1LCDCSGBHdKcxp7ZsRKNqmdgYourimhCmG
4-
hicetnunc baker oracle: https://better-call.dev/mainnet/KT1LG5kyGzoGRzrNLZWp44nQjXMbs5N52CBg/operations
5-
hicetnuncDAO sample: https://better-call.dev/mainnet/KT1VjEfVuwA4A1cuHvugTwrtZSvhPv9JwwbR
6-
FA2: https://better-call.dev/mainnet/KT1FaKvzjgVGZtiA7yyx97txY8J5cE5qpjQ1
3+
hicetnunc protocol: https://better-call.dev/mainnet/KT1Q72pNNiCnBamwttWvXGE9N2yuz6c7guSD
4+
hicetnunc baker oracle: https://better-call.dev/mainnet/KT1PdHb2tnTuyMo7JC8jcj1uw3A41QuWEeii
5+
hicetnuncDAO sample: https://better-call.dev/mainnet/KT1UcPh3S1K1GAFqUt212H9qjFVdxEnca1qk
6+
FA2: https://better-call.dev/mainnet/KT1Ex8LrDbCrZuTgmWin8eEo7HFw74jAqTvz

hicetnunc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ def update_oracle(self, params):
5656
def update_meta(self, params):
5757
sp.verify(sp.sender == self.data.admin)
5858
self.data.meta = params
59-
59+
60+
@sp.entry_point
61+
def update_admin(self, params):
62+
sp.verify(sp.sender == self.data.admin)
63+
self.data.admin = params
64+
6065
#oracle/admin staking
6166
@sp.entry_point
6267
def set_baker(self, params):
6368
sp.verify((sp.sender == self.data.oracle) | (sp.sender == self.data.admin))
6469

6570
sp.set_delegate(sp.some(params))
66-
67-
71+
6872
@sp.entry_point
6973
def withdraw(self, params):
7074
sp.verify(sp.sender == self.data.admin) # comment for testing

hicetnunc_protocol.tz

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ code
1919
IF_SOME
2020
{}
2121
{
22-
PUSH int 114;
22+
PUSH int 119;
2323
FAILWITH;
2424
};
2525
COMPARE;
@@ -39,7 +39,7 @@ code
3939
IF_SOME
4040
{}
4141
{
42-
PUSH int 117;
42+
PUSH int 122;
4343
FAILWITH;
4444
};
4545
PUSH mutez 0;
@@ -113,7 +113,7 @@ code
113113
PUSH mutez 0;
114114
NONE key_hash;
115115
CREATE_CONTRACT
116-
{ parameter (or (or (unit %contribute) (key_hash %set_baker)) (or (string %update_meta) (or (address %update_oracle) (pair %withdraw (address %address) (mutez %amount)))));
116+
{ parameter (or (or (unit %contribute) (or (key_hash %set_baker) (address %update_admin))) (or (string %update_meta) (or (address %update_oracle) (pair %withdraw (address %address) (mutez %amount)))));
117117
storage (pair (pair (pair (mutez %achieved) (address %admin)) (pair (mutez %goal) (string %meta))) (pair (pair (address %oracle) (address %protocol)) (pair (timestamp %time_lock) (nat %token_id))));
118118
code
119119
{
@@ -199,16 +199,39 @@ code
199199
CONS;
200200
}
201201
{
202-
SWAP;
203-
DUP;
204-
DUG 2;
205-
CDAAR;
206-
SENDER;
207-
COMPARE;
208-
EQ;
209-
IF
202+
IF_LEFT
210203
{
211-
PUSH bool True;
204+
SWAP;
205+
DUP;
206+
DUG 2;
207+
CDAAR;
208+
SENDER;
209+
COMPARE;
210+
EQ;
211+
IF
212+
{
213+
PUSH bool True;
214+
}
215+
{
216+
SWAP;
217+
DUP;
218+
DUG 2;
219+
CAADR;
220+
SENDER;
221+
COMPARE;
222+
EQ;
223+
};
224+
IF
225+
{}
226+
{
227+
PUSH string "WrongCondition: (sp.sender == self.data.oracle) | (sp.sender == self.data.admin)";
228+
FAILWITH;
229+
};
230+
SOME;
231+
SET_DELEGATE;
232+
NIL operation;
233+
SWAP;
234+
CONS;
212235
}
213236
{
214237
SWAP;
@@ -218,18 +241,28 @@ code
218241
SENDER;
219242
COMPARE;
220243
EQ;
244+
IF
245+
{}
246+
{
247+
PUSH string "WrongCondition: sp.sender == self.data.admin";
248+
FAILWITH;
249+
};
250+
SWAP;
251+
DUP;
252+
CDR;
253+
SWAP;
254+
CAR;
255+
DUP;
256+
CDR;
257+
SWAP;
258+
CAAR;
259+
DIG 3;
260+
SWAP;
261+
PAIR;
262+
PAIR;
263+
PAIR;
264+
NIL operation;
221265
};
222-
IF
223-
{}
224-
{
225-
PUSH string "WrongCondition: (sp.sender == self.data.oracle) | (sp.sender == self.data.admin)";
226-
FAILWITH;
227-
};
228-
SOME;
229-
SET_DELEGATE;
230-
NIL operation;
231-
SWAP;
232-
CONS;
233266
};
234267
}
235268
{
@@ -345,7 +378,7 @@ code
345378
IF_SOME
346379
{}
347380
{
348-
PUSH int 71;
381+
PUSH int 76;
349382
FAILWITH;
350383
};
351384
DIG 2;
@@ -381,7 +414,7 @@ code
381414
IF_SOME
382415
{}
383416
{
384-
PUSH int 93;
417+
PUSH int 98;
385418
FAILWITH;
386419
};
387420
DIG 5;

0 commit comments

Comments
 (0)