DragandDropGroup commited on
Commit
e85707b
·
verified ·
1 Parent(s): 8d32176

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +43 -42
src/streamlit_app.py CHANGED
@@ -12,53 +12,54 @@ wallet_address = st.text_input("Enter your wallet address:")
12
  private_key = st.text_input("Enter your private key:", type="password")
13
  infura_url = st.text_input("Enter your Infura URL:")
14
 
15
- # ✅ Correct ABI for IPFSStorage
 
 
16
  contract_abi = json.loads("""
17
  [
18
- {
19
- "inputs": [
20
- {
21
- "internalType": "string",
22
- "name": "ipfsHash",
23
- "type": "string"
24
- }
25
- ],
26
- "name": "storeHash",
27
- "outputs": [],
28
- "stateMutability": "nonpayable",
29
- "type": "function"
30
- },
31
- {
32
- "inputs": [],
33
- "name": "getHashes",
34
- "outputs": [
35
- {
36
- "internalType": "string[]",
37
- "name": "",
38
- "type": "string[]"
39
- }
40
- ],
41
- "stateMutability": "view",
42
- "type": "function"
43
- },
44
- {
45
- "anonymous": false,
46
- "inputs": [
47
- {
48
- "indexed": false,
49
- "internalType": "string",
50
- "name": "ipfsHash",
51
- "type": "string"
52
- }
53
- ],
54
- "name": "Store",
55
- "type": "event"
56
- }
57
  ]
58
  """)
59
 
60
- # Correct bytecode for IPFSStorage compiled using Solidity ^0.8.2
61
- contract_bytecode = "608060405234801561001057600080fd5b506101c8806100206000396000f3fe6080604052600436106100295760003560e01c80636d4ce63c1461002e578063c0d7865514610056575b600080fd5b610054600480360381019061004f919061010f565b610072565b005b61006e6004803603810190610069919061010f565b6100a3565b60405161007b9190610156565b60405180910390f35b806000819055507f87b6f9c290b7eac435b09e1f693e67d439f5e99f3dbf09e02ff8cc63575f80e0336040516100d89190610156565b60405180910390a150565b60008054905090565b6000813590506100f6816101a1565b92915050565b6000602082840312156101125761011161019c565b5b6000610120848285016100e7565b91505092915050565b61013281610163565b82525050565b600060208201905061014d6000830184610129565b92915050565b60008115159050919050565b600060ff82169050919050565b61017281610163565b811461017d57600080fd5b5056fea264697066735822122055b2f8b69d164ed8a8e3eb5e625a5e5ffefc77f14827c98b2d52ea84295c56fc64736f6c63430008040033"
62
 
63
  # Deploy contract when button is clicked
64
  if st.button("Deploy Contract"):
 
12
  private_key = st.text_input("Enter your private key:", type="password")
13
  infura_url = st.text_input("Enter your Infura URL:")
14
 
15
+ #ABI for IPFSStorage
16
+ import json
17
+
18
  contract_abi = json.loads("""
19
  [
20
+ {
21
+ "anonymous": false,
22
+ "inputs": [
23
+ {
24
+ "indexed": false,
25
+ "internalType": "string",
26
+ "name": "ipfsHash",
27
+ "type": "string"
28
+ }
29
+ ],
30
+ "name": "Store",
31
+ "type": "event"
32
+ },
33
+ {
34
+ "inputs": [],
35
+ "name": "getHashes",
36
+ "outputs": [
37
+ {
38
+ "internalType": "string[]",
39
+ "name": "",
40
+ "type": "string[]"
41
+ }
42
+ ],
43
+ "stateMutability": "view",
44
+ "type": "function"
45
+ },
46
+ {
47
+ "inputs": [
48
+ {
49
+ "internalType": "string",
50
+ "name": "ipfsHash",
51
+ "type": "string"
52
+ }
53
+ ],
54
+ "name": "storeHash",
55
+ "outputs": [],
56
+ "stateMutability": "nonpayable",
57
+ "type": "function"
58
+ }
59
  ]
60
  """)
61
 
62
+ contract_bytecode = "0x608060405234801561001057600080fd5b50610655806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634245d48e1461003b57806371dc61cb14610059575b600080fd5b610043610075565b604051610050919061040b565b60405180910390f35b610073600480360381019061006e91906102cf565b61014e565b005b60606000805480602002602001604051908101604052809291908181526020016000905b828210156101455783829060005260206000200180546100b89061054d565b80601f01602080910402602001604051908101604052809291908181526020018280546100e49061054d565b80156101315780601f1061010657610100808354040283529160200191610131565b820191906000526020600020905b81548152906001019060200180831161011457829003601f168201915b505050505081526020019060010190610099565b50505050905090565b6000819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906101899291906101c4565b507f4f9c5253c28d756a479eda13b65899a3ad16e0b50d4100ef22348b747b709216816040516101b9919061042d565b60405180910390a150565b8280546101d09061054d565b90600052602060002090601f0160209004810192826101f25760008555610239565b82601f1061020b57805160ff1916838001178555610239565b82800160010185558215610239579182015b8281111561023857825182559160200191906001019061021d565b5b509050610246919061024a565b5090565b5b8082111561026357600081600090555060010161024b565b5090565b600061027a61027584610474565b61044f565b90508281526020810184848401111561029257600080fd5b61029d84828561050b565b509392505050565b600082601f8301126102b657600080fd5b81356102c6848260208601610267565b91505092915050565b6000602082840312156102e157600080fd5b600082013567ffffffffffffffff8111156102fb57600080fd5b610307848285016102a5565b91505092915050565b600061031c8383610399565b905092915050565b600061032f826104b5565b61033981856104d8565b93508360208202850161034b856104a5565b8060005b8581101561038757848403895281516103688582610310565b9450610373836104cb565b925060208a0199505060018101905061034f565b50829750879550505050505092915050565b60006103a4826104c0565b6103ae81856104e9565b93506103be81856020860161051a565b6103c78161060e565b840191505092915050565b60006103dd826104c0565b6103e781856104fa565b93506103f781856020860161051a565b6104008161060e565b840191505092915050565b600060208201905081810360008301526104258184610324565b905092915050565b6000602082019050818103600083015261044781846103d2565b905092915050565b600061045961046a565b9050610465828261057f565b919050565b6000604051905090565b600067ffffffffffffffff82111561048f5761048e6105df565b5b6104988261060e565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b82818337600083830152505050565b60005b8381101561053857808201518184015260208101905061051d565b83811115610547576000848401525b50505050565b6000600282049050600182168061056557607f821691505b60208210811415610579576105786105b0565b5b50919050565b6105888261060e565b810181811067ffffffffffffffff821117156105a7576105a66105df565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f830116905091905056fea264697066735822122048abd857324db30c9ef1d5b905b229d966a49e007230d72ee76cf68a7716abbe64736f6c63430008020033"
 
63
 
64
  # Deploy contract when button is clicked
65
  if st.button("Deploy Contract"):