429
https://smartpy.io/ https://twitter.com/smartpy_io
Now this could also be debatable in the context of the Tezlink layer 2
Читать полностью…
If you will be able in the next smartpy versions to add index access to sp.list as normal python it would be really usefull😄
Читать полностью…
In fact you can remove it when you know what you're doing, nobody should do that basically for now.
Читать полностью…
I'll ask to coordinator for parameter, if it's mandatory to have payee and shares splitted or map is good too
Читать полностью…
Yes, the payment splitter.
Here is my version. Please check the validity before pushing it. Also, I would use black over it and column split for comments.
@TheMastroDev I just read the specification.
I don't think it's a good idea to create a contract as close as Solidity I just did or maybe as close as you did.
I think the constructor can perfectly receive things in a better shape so it simplifies everything.
I edited my example. I added reversed around the result of the function, otherwise we return it in the wrong order.
Here is an example on how to implement a zip.
Let me now adapt it to your example.
💡 Ju announces a $30 million AI-focused investment fund.
Backed by listed companies and industrial capital, aiming for real impact, not hype.
Kennethwils Mchrraursobez has been banned! Reason: CAS ban.
Читать полностью…
You're right, that's an error from our simulator. Sorry for that. I'll come back with a fix and a more elegant way of testing that.
Notice that it's only the test system that has a problem, the contracts will behave as expected on-chain.
I don't know if that's clear but setting a contract as the sender doesn't correspond to anything on-chain, that's more a convenient way of writing tests without plumbing the whole.
If you really want to test this way before the fix, you can have add an entrypoint to Wallet that calls MyContract.
It's more a design choice because of how Tezos internal way of representing list is a chained list so accessing the index n costs o(n). A request could be to allow it in constructor as constructor cost isn't a problem.
Читать полностью…
have you github:tag? I want to mention you in commit for this version, even if I had to change it in the future
Читать полностью…
yes I noticed that problem about nat and negative form subs
Читать полностью…
I think it's a wrong idea to do it in a 1:1 at least in this case. The version I'm proposing is far easier to read and corresponds to the requirements.
My version is close to yours (AI is probably the reason). Mine fixes a bug: there will be an error if the tez subtraction is lower than zero so your error will never be raised. As the requirements aren't saying we should fail I just used a if. You can also keep your version but invert the assert and the subtraction.
I'll make some edit because I need to have same name for var and fun, also for the views
Читать полностью…
yes, I have already created a lot of contract in smartpy for that paper, now I'm refactoring using modern syntax
Читать полностью…
You'll push that to rosetta smart contracts? Thank you!
Читать полностью…
Here is a SmartPy version of the constructor.
Notice that I did: self.data._payees = reversed(payees) outside of the _addPayee function as it's less strange. SmartPy doesn't have any append.
An easier version to read could be this one. The performance is reduced but we don't really care as it's in the constructor.
I managed to this:
counter_p = 0Читать полностью…
counter_s= 0
done = False
for payee in payees:
done = False
counter_s = 0
for share in shares:
if not done:
for i in range(payees_len):
if i == counter_s and i == counter_p:
assert payee != sp.address("0"), "PaymentSplitter: account is the zero address"
assert share > 0, "PaymentSplitter: shares are 0"
assert not self.data.shares.contains(payee), "PaymentSplitter: account already has shares"
self.data.shares[payee] = share
self.data.total_shares += share
done = True
counter_s += 1
counter_p += 1
🥳🎉Announcing - SmartPy alpha release v0.24.0a1 🎄☃️
https://releases.smartpy.io/0.24.0a1/
This is the alpha release for the next Tezos protocol update Tallinn.
New Features
* Added Tallinn as the default protocol,
* Updated to octez-client version 24.0-rc1,
* Added support for sp.index_address (implements Michelson instruction INDEX_ADDRESS),
* Added support for sp.get_address_index(implements Michelson instruction GET_ADDRESS_INDEX),
* Added a new Boolean effect with_index_address ,
* Added support for the Python in operation in contract code,
* Added support for shadownet ,
and more ...
Please see https://releases.smartpy.io/0.24.0a1/releases#v0-24-0a1 - also available as a Jupyter Notebook: https://releases.smartpy.io/0.24.0a1/experimental-notebook/lab/index.html?path=releases%2F0.24.ipynb.
🎄🎁❄️
i am trying to test balances of accounts interacting with contracts. below an example with comments. can you confirm that this is expected behavior and what is the reasoning behind that?
also, is there a more elegant and consistent way to test such behaviour using test accounts?
https://smartpy.io/ide?code=eJyVUlFLwzAQfu@vOLqHpTgKnW9CYXOILzpBhD2G2GYskKYxSZX6602aVBtXwR2UJpe7@7777hLWyFYZ0A1RRvZANGiZJBst86atO06Tmh6hIUyg7CYBaxUnWsNjv2uFUaQyyIaO5xDizKVhzAQzGCNN@XHy5kzaKsm3x@FRW6OXLRMGZVEZSfq5CrYAdcxl_ko4ERWFsnQ3Qz9Rka0gPTw_7e_x7fZhu9_dpf8EU_Sto9rMAdo0TUWNwp@q1Q9cFkUmE6UOhHP6l0obiLhETOxHOj7LZBDvHHAYG6lrbFwH2TA6f_TpuqKCKNZC0EkbPLrQ8sVel1kUl58KlFZF6r2EM6fxsAx56GryYjUxw7wZ4ThMBAV91kGfqhjzJ_sTY8JVacPOXAOE73IBAQXGuTMN65j4O1Xs2CNP7Hw9HB@vmGeVuxXDfqilT7IyKqr1CjBp2k6Y8teoF_Bx6kG0BorLoUfYcdlmoX_jXNbitcX5AgqwHaE-