This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
update_contracts.py
99 lines (91 loc) · 4.61 KB
/
update_contracts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# '../v2-did-locking-contract/src/V2DidLockingContract.hs'
# '../v2-did-locking-contract/src/V2DidLockingContract-new.hs'
def changeVoteHash(oldPath,newPath,newText):
pattern = 'voteValidatorHash = PlutusV2.ValidatorHash $ UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + "\n"
file2.write(line)
def changeLockHash(oldPath,newPath,newText):
pattern = 'getValidatorHash = PlutusV2.ValidatorHash $ UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + "\n"
file2.write(line)
def changeStartLockPid(oldPath,newPath,newText):
pattern = 'lockPid = PlutusV2.CurrencySymbol {PlutusV2.unCurrencySymbol = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeStartLockTkn(oldPath,newPath,newText):
pattern = 'lockTkn = PlutusV2.TokenName {PlutusV2.unTokenName = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeStartVotePid(oldPath,newPath,newText):
pattern = 'voteStartPid = PlutusV2.CurrencySymbol { PlutusV2.unCurrencySymbol = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeStartVoteTkn(oldPath,newPath,newText):
pattern = 'voteStartTkn = PlutusV2.TokenName { PlutusV2.unTokenName = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeTokenizedPid(oldPath,newPath,newText):
pattern = 'tokenizedPid = PlutusV2.CurrencySymbol { PlutusV2.unCurrencySymbol = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeDelegPkh(oldPath,newPath,newText):
pattern = 'getPkh = PlutusV2.PubKeyHash { PlutusV2.getPubKeyHash = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern in line:
# create teh new addition
line = pattern + " " + str(newText) + " }\n"
file2.write(line)
def changeMultiPkh(oldPath,newPath,newText1,newText2,newText3):
pattern1 = 'multiPkh1 = PlutusV2.PubKeyHash { PlutusV2.getPubKeyHash = UsefulFuncs.createBuiltinByteString'
pattern2 = 'multiPkh2 = PlutusV2.PubKeyHash { PlutusV2.getPubKeyHash = UsefulFuncs.createBuiltinByteString'
pattern3 = 'multiPkh3 = PlutusV2.PubKeyHash { PlutusV2.getPubKeyHash = UsefulFuncs.createBuiltinByteString'
with open(oldPath, 'r') as file1:
with open(newPath, 'w+') as file2:
for line in file1:
if pattern1 in line:
# create teh new addition
line = pattern1 + " " + str(newText1) + " }\n"
if pattern2 in line:
# create teh new addition
line = pattern2 + " " + str(newText2) + " }\n"
if pattern3 in line:
# create teh new addition
line = pattern3 + " " + str(newText3) + " }\n"
file2.write(line)