Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,11 +20,10 @@ text_init = st.text_area('Enter init description')
|
|
20 |
text_deploy = st.text_area('Enter deploy description')
|
21 |
text_invariant = st.text_area('Enter invariant description')
|
22 |
if st.button('GENERATE RESPONSE'):
|
23 |
-
st.write(text_init, text_deploy, text_invariant)
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
# print(response)
|
|
|
20 |
text_deploy = st.text_area('Enter deploy description')
|
21 |
text_invariant = st.text_area('Enter invariant description')
|
22 |
if st.button('GENERATE RESPONSE'):
|
23 |
+
# st.write(text_init, text_deploy, text_invariant)
|
24 |
+
# Instruction
|
25 |
+
instruction = f'Using the descriptions, write the init code, deploy code and invariant code'
|
26 |
+
knowledge = "EXAMPLE:{init description: [“Create a new address called “user”. Give the “user” “AMOUNT” of LP tokens. Using the “user” as the sender approve the “StaxLPStaking” contract to use his LP tokens and stake all the LP tokens into the “StaxLPStaking” contract.“],\n deploy description: [“Create a new address called “owner”. Using the “owner” as the sender deploy the “StaxLP” contract and the “StaxLPStaking” contract.“],\n invariant description: [“Using the “user” address as sender withdraw all the LP tokens from the “StaxLPStaking” contract and check the balance of the LP tokens of the “user” is not less than “AMOUNT”.“],\n init code: [{\naddress public user;\nuint256 public constant AMOUNT = 10e18;\nfunction init() public {\n user = makeAddr(“USER”);\n deal(address(lp), user, AMOUNT);\n vm.startPrank(user);\n lp.approve(address(lpStaking), lp.balanceOf(user));\n lpStaking.stakeAll();\n vm.stopPrank();\n}\n }],\n deploy code: [{\nStaxLP public lp;\nStaxLPStaking public lpStaking;\naddress public owner;\nfunction deploy() public {\n owner = makeAddr(“OWNER”);\n vm.startPrank(owner);\n lp = new StaxLP(“Stax Frax/Temple LP Token”, “xFraxTempleLP”);\n lpStaking = new StaxLPStaking(address(lp), owner);\n vm.stopPrank();\n}\n }],\n invariant code: [{\nfunction invariant() public {\n vm.prank(user);\n lpStaking.withdrawAll(false);\n assert(lp.balanceOf(user) >= AMOUNT);\n}\n }],\n}\n]"
|
27 |
+
dialog = [f'\{init description: [“{text_init}“],\n deploy description: [“{text_deploy}“],\n invariant description: [“{text_invariant}“],\n\}']
|
28 |
+
response = generate(instruction, knowledge, dialog)
|
29 |
+
st.write(response)
|
|