-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choose/elaborate a configurable smart contract to add to Nebula's UI #5
Comments
Alright ! we have one candidate here ready for review : #12 Its about a simple voting example. I think it could be easily configurable by the wizard. Its still a draft though, waiting for feedback :) Others are under investigation right now, like the Adding @geofmureithi and @mariopil to the ➿ ! |
We have the raffle example #13 ready for review. |
Alright ! we are unit testing the contracts, but maybe its a good moment to check the soroban tools for deploying them. Looks like we have plenty of options !
I think i am going to test both in review contracts and write here my findings. cc: @geofmureithi |
Alright ! after some difficulties with the tooling and the Before that lets just take into account that:
|
Raffle contract example Futurenet test resultsAlright, lets test the lottery contract 🍿 ! We need to do some preparations in order to achieve this. Lets create our admin contract and players ! For doing that, we need to go to the laboratory. We have created and fund (with friendbot faucet helper) the following addresses:
Now we need to build the contract by going to root of the contract folder $ soroban contract build Then, optimise the wasm by:
That will give us the needed wasm file under $ soroban contract deploy \
--source SCXBOAMHMCLODJ6IAA55RPOHJWHQMXU6YUI24JUH6SEL7XHGDXOKK3RM \
--wasm target/wasm32-unknown-unknown/release/lottery.optimized.wasm \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022'
CAUKCX6RZPDM25L5YFTBUIZK5WDTTB4SHL2WB65EULRCRIP25PWNEXC3 As we are testing in $ soroban lab token id --asset native --network futurenet
CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT Now we need to initialise our raffle. Lets invoke the soroban contract invoke \
--id CAUKCX6RZPDM25L5YFTBUIZK5WDTTB4SHL2WB65EULRCRIP25PWNEXC3 \
--source SCXBOAMHMCLODJ6IAA55RPOHJWHQMXU6YUI24JUH6SEL7XHGDXOKK3RM \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- \
init \
--admin GAH6O4LPMME6INTWXFS3IVZBGDSCN7KCSIAENUNDVQEJKT2D5ILLNYYR \
--token CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT \
--max_winners_count 1 \
--ticket_price 5001 Great ! we have our raffle initialised. Lets buy some tickets now for
Notice we changed the Now its time to play the raffle ! Lets invoke it by: soroban contract invoke \
--id CAUKCX6RZPDM25L5YFTBUIZK5WDTTB4SHL2WB65EULRCRIP25PWNEXC3 \
--source SCXBOAMHMCLODJ6IAA55RPOHJWHQMXU6YUI24JUH6SEL7XHGDXOKK3RM \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- \
play_raffle \
--random_seed 1234 By checking the balances of our users, we can assert it worked well:
We can observe by the new balances that
With this steps, we just confirmed the raffle is properly working for the happy path in Futurenet. Other notes
|
Voting contract example Futurenet test resultsAlright, lets test the voting contract 🍿 ! We will use the same accounts from the raffle example.
Now we need to build the contract by going to root of the contract folder $ soroban contract build Then, optimise the wasm by:
That will give us the needed wasm file under $ soroban contract deploy \
--source SCXBOAMHMCLODJ6IAA55RPOHJWHQMXU6YUI24JUH6SEL7XHGDXOKK3RM \
--wasm target/wasm32-unknown-unknown/release/voting.optimized.wasm \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022'
CCNYMNCHVCAYGZK5566WINJPG4CTNMCIY4QTUN3FHYDE4FT4AANKXW2M Now we need to initialise our voting contract. Lets invoke the soroban contract invoke \
--id CCNYMNCHVCAYGZK5566WINJPG4CTNMCIY4QTUN3FHYDE4FT4AANKXW2M \
--source SCXBOAMHMCLODJ6IAA55RPOHJWHQMXU6YUI24JUH6SEL7XHGDXOKK3RM \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- \
init \
--admin GAH6O4LPMME6INTWXFS3IVZBGDSCN7KCSIAENUNDVQEJKT2D5ILLNYYR \
--voting_period_secs 3600 \
--target_approval_rate_bps 50000 \
--total_voters 3 Great ! we have our voting contract is initialised. Lets now create a sample proposal:
Notice we changed the Now its time to vote ! soroban contract invoke \
--id CCNYMNCHVCAYGZK5566WINJPG4CTNMCIY4QTUN3FHYDE4FT4AANKXW2M \
--source SDMBPBRM4TY33SB7PJ3X46I4OOEAIP4LU4CGLX7DCWBJZH6BLEMQJHSB \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- \
vote \
--voter GDASG2GN2FLMJEVPW423LW6UVVLZXNGLU7H5QR5IHAJCE3VWKSOSRRC6 \
--id 1 The above votes for Lets check it, by inspecting events.
With the above tests we concluded this first version of the voting contract to work in futurenet. |
This issue has alot of knowledge, maybe it should be organized into some structured docs. |
Context
A part of Nebula is going to be an UI that helps developers building smart contracts in a configurable way.
Goals
The text was updated successfully, but these errors were encountered: