Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Add auth example and update auth learn page #95

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

sisuresh
Copy link
Contributor

No description provided.

@stellar-jenkins
Copy link

@sisuresh sisuresh merged commit a2c15d6 into stellar-deprecated:dev Aug 30, 2022
let key = DataKey::Nonce(id.clone());
let nonce = Self::read_nonce(e, id);
e.contract_data()
.set(key, nonce.clone() + BigInt::from_u32(e, 1));
Copy link
Contributor

@leighmcculloch leighmcculloch Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi you can just do + 1.

-             .set(key, nonce.clone() + BigInt::from_u32(e, 1));
+             .set(key, &nonce + 1);

&e,
&WrappedAuth(auth),
nonce.clone(),
Symbol::from_str("save_data"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use symbol!? It reduces the code size considerably and was added in this release.

-            Symbol::from_str("save_data"),
+            symbol!("save_data"),

Comment on lines +78 to +82
pub struct AuthContract;

#[cfg_attr(feature = "export", contractimpl)]
#[cfg_attr(not(feature = "export"), contractimpl(export = false))]
impl AuthContract {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename the contract to ExampleContract? The name AuthContract tripped me up the first time I saw it because I thought it was a contract that provided authorization. I think this could trip others up too, like this is an example of a contract that provides authorization rather than an example of how to do authorization.

title: Authorization
---

The [authorization example] demonstrates how to write a contract function that
Copy link
Contributor

@leighmcculloch leighmcculloch Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- The [authorization example] demonstrates how to write a contract function that
+ The [authorization example] demonstrates how to add authorization to a contract, and how to write a contract function that

leighmcculloch added a commit that referenced this pull request Aug 31, 2022
* noop

* noop

* Update sdk and cli versions and output (#87)

* Update code samples in quickstart (#88)

* empty

* Update the tutorial for creating a project (#89)

* Update the tutorial for writing a contract (#90)

* Update the tutorial for testing (#91)

* Update the hello_world contract (#92)

* Small fix to hello contract

* Update the increment contract (#93)

* Small fix to increment example

* Update the custom_types contract (#94)

* Add auth example and update auth learn page (#95)

* Put auth example earlier in list of examples

Co-authored-by: Tyler van der Hoeven <[email protected]>
Co-authored-by: Siddharth Suresh <[email protected]>
leighmcculloch added a commit that referenced this pull request Sep 2, 2022
* noop

* noop

* Update sdk and cli versions and output (#87)

* Update code samples in quickstart (#88)

* empty

* Update the tutorial for creating a project (#89)

* Update the tutorial for writing a contract (#90)

* Update the tutorial for testing (#91)

* Update the hello_world contract (#92)

* Small fix to hello contract

* Update the increment contract (#93)

* Small fix to increment example

* Update the custom_types contract (#94)

* Add auth example and update auth learn page (#95)

* Put auth example earlier in list of examples (#98)

(cherry picked from commit fc2fc75)

* Add events example (#100)

* Update the cross_contract contract (#99)

* Small tweak to contract call doc

* Fix to contract call code sample

* Fix to contract call code sample

* noop to try and make it deploy properly

* Reorder examples so that contract events appears higher in list

* Fix headings of cross contract example (#102)

* Add soroban-cli read example

* Tweak language about developer discord

* Some changes to the events example page (#101)

* Rename standard-contracts and update token-contract (#103)

* Rename Standard Contracts to Built-In Contracts

* Update built-in-contracts/token-contract and examples/authorization

* Fix title capitalization of built-in contracts page (#104)

* Add stub for token example (#105)

* Update authorization docs to line up with contract examples (#106)

* Small fixes for token contract doc

* Make authorization docs line up with the example

* Instruct users to checkout v0.0.4 tag for examples (#107)

* fix pages and sdk instructions

* Add auth sdk page

Co-authored-by: Tyler van der Hoeven <[email protected]>
Co-authored-by: Siddharth Suresh <[email protected]>
Co-authored-by: Jay Geng <[email protected]>
Co-authored-by: jonjove <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants