Unverified Commit 9bda2031 authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Spellchecking for examples + Fix master CI (#812)

* Spellcheck examples as well

* Remove non-existent method

* Fix language

* Fix clippy `needless_borrow`

https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow



* Fix spellchecking for examples

* Add `block_timestamp` in `engine`

* Update examples/erc721/lib.rs
Co-authored-by: default avatarRobin Freyler <robin.freyler@gmail.com>

* Find solution for words which are non-existent
Co-authored-by: default avatarRobin Freyler <robin.freyler@gmail.com>
parent 2458e0c0
Pipeline #141453 passed with stages
in 25 minutes and 21 seconds
......@@ -118,7 +118,7 @@ pub fn forward_pull_packed<T>(ptr: &mut KeyPtr) -> T
where
T: PackedLayout,
{
pull_packed_root::<T>(&ptr.next_for::<T>())
pull_packed_root::<T>(ptr.next_for::<T>())
}
/// Pushes an instance of type `T` in packed fashion to the contract storage.
......@@ -135,7 +135,7 @@ pub fn forward_push_packed<T>(entity: &T, ptr: &mut KeyPtr)
where
T: PackedLayout,
{
push_packed_root::<T>(entity, &ptr.next_for::<T>())
push_packed_root::<T>(entity, ptr.next_for::<T>())
}
/// Clears an instance of type `T` in packed fashion from the contract storage.
......@@ -152,5 +152,5 @@ pub fn forward_clear_packed<T>(entity: &T, ptr: &mut KeyPtr)
where
T: PackedLayout,
{
clear_packed_root::<T>(entity, &ptr.next_for::<T>())
clear_packed_root::<T>(entity, ptr.next_for::<T>())
}
......@@ -19,7 +19,7 @@ use ink_lang as ink;
#[ink::contract]
pub mod accumulator {
/// Holds a simple i32 value that can be incremented and decremented.
/// Holds a simple `i32` value that can be incremented and decremented.
#[ink(storage)]
pub struct Accumulator {
value: i32,
......
......@@ -21,21 +21,21 @@ use ink_lang as ink;
mod adder {
use accumulator::Accumulator;
/// Increments the underlying accumulator's value.
/// Increments the underlying `accumulator` value.
#[ink(storage)]
pub struct Adder {
/// The accumulator to store the value.
/// The `accumulator` to store the value.
accumulator: accumulator::Accumulator,
}
impl Adder {
/// Creates a new adder from the given accumulator.
/// Creates a new `adder` from the given `accumulator`.
#[ink(constructor)]
pub fn new(accumulator: Accumulator) -> Self {
Self { accumulator }
}
/// Increases the accumulator's value by some amount.
/// Increases the `accumulator` value by some amount.
#[ink(message)]
pub fn inc(&mut self, by: i32) {
self.accumulator.inc(by)
......
......@@ -55,23 +55,23 @@ mod delegator {
Subber,
}
/// Delegates calls to an adder or subber contract to mutate
/// a value in an accumulator contract.
/// Delegates calls to an `adder` or `subber` contract to mutate
/// a value in an `accumulator` contract.
///
/// In order to deploy the delegator smart contract we first
/// have to manually put the code of the accumulator, adder
/// and subber smart contracts, receive their code hashes from
/// have to manually put the code of the `accumulator`, `adder`
/// and `subber` smart contracts, receive their code hashes from
/// the signalled events and put their code hash into our
/// delegator smart contract.
#[ink(storage)]
pub struct Delegator {
/// Says which of adder or subber is currently in use.
/// Says which of `adder` or `subber` is currently in use.
which: Which,
/// The accumulator smart contract.
/// The `accumulator` smart contract.
accumulator: Lazy<Accumulator>,
/// The adder smart contract.
/// The `adder` smart contract.
adder: Lazy<Adder>,
/// The subber smart contract.
/// The `subber` smart contract.
subber: Lazy<Subber>,
}
......@@ -113,7 +113,7 @@ mod delegator {
}
}
/// Returns the accumulator's value.
/// Returns the `accumulator` value.
#[ink(message)]
pub fn get(&self) -> i32 {
self.accumulator.get()
......
......@@ -21,21 +21,21 @@ use ink_lang as ink;
mod subber {
use accumulator::Accumulator;
/// Decreases the underlying accumulator's value.
/// Decreases the underlying `accumulator` value.
#[ink(storage)]
pub struct Subber {
/// The accumulator to store the value.
/// The `accumulator` to store the value.
accumulator: accumulator::Accumulator,
}
impl Subber {
/// Creates a new subber from the given accumulator.
/// Creates a new `subber` from the given `accumulator`.
#[ink(constructor)]
pub fn new(accumulator: Accumulator) -> Self {
Self { accumulator }
}
/// Decreases the accumulator's value by some amount.
/// Decreases the `accumulator` value by some amount.
#[ink(message)]
pub fn dec(&mut self, by: i32) {
self.accumulator.inc(-by)
......
......@@ -46,7 +46,7 @@ mod dns {
new_address: AccountId,
}
/// Emitted whenver a name is being transferred.
/// Emitted whenever a name is being transferred.
#[ink(event)]
pub struct Transfer {
#[ink(topic)]
......@@ -70,8 +70,8 @@ mod dns {
///
/// The main function of this contract is domain name resolution which
/// refers to the retrieval of numeric values corresponding to readable
/// and easily memorable names such as polka.dot which can be used
/// to facilitate transfers, voting and dapp-related operations instead
/// and easily memorable names such as "polka.dot" which can be used
/// to facilitate transfers, voting and DApp-related operations instead
/// of resorting to long IP addresses that are hard to remember.
#[ink(storage)]
#[derive(Default)]
......@@ -232,7 +232,7 @@ mod dns {
Err(Error::CallerIsNotOwner)
);
// caller is owner, set_address will be successful
// Caller is owner, set_address will be successful
set_next_caller(accounts.alice);
assert_eq!(contract.set_address(name, accounts.bob), Ok(()));
assert_eq!(contract.get_address(name), accounts.bob);
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # ERC721
//! # ERC-721
//!
//! This is an ERC721 Token implementation.
//! This is an ERC-721 Token implementation.
//!
//! ## Warning
//!
......@@ -27,9 +27,9 @@
//!
//! ## Error Handling
//!
//! Any function that modifies the state returns a Result type and does not changes the state
//! if the Error occurs.
//! The errors are defined as an Enum type. Any other error or invariant violation
//! Any function that modifies the state returns a `Result` type and does not changes the state
//! if the `Error` occurs.
//! The errors are defined as an `enum` type. Any other error or invariant violation
//! triggers a panic and therefore rolls back the transaction.
//!
//! ## Token Management
......@@ -54,7 +54,7 @@
//! - An authorized operator of the current owner of a token
//!
//! The token owner can transfer a token by calling the `transfer` or `transfer_from` functions.
//! An approved address can make a token transfer by calling the `transfer_from` funtion.
//! An approved address can make a token transfer by calling the `transfer_from` function.
//! Operators can transfer tokens on another account's behalf or can approve a token transfer
//! for a different account.
//!
......@@ -141,7 +141,7 @@ mod erc721 {
}
impl Erc721 {
/// Creates a new ERC721 token contract.
/// Creates a new ERC-721 token contract.
#[ink(constructor)]
pub fn new() -> Self {
Self {
......@@ -259,7 +259,7 @@ mod erc721 {
Ok(())
}
/// Transfers token `id` `from` the sender to the `to` AccountId.
/// Transfers token `id` `from` the sender to the `to` `AccountId`.
fn transfer_token_from(
&mut self,
from: &AccountId,
......@@ -354,7 +354,7 @@ mod erc721 {
}
}
/// Approve the passed AccountId to transfer the specified token on behalf of the message's sender.
/// Approve the passed `AccountId` to transfer the specified token on behalf of the message's sender.
fn approve_for(&mut self, to: &AccountId, id: TokenId) -> Result<(), Error> {
let caller = self.env().caller();
let owner = self.owner_of(id);
......@@ -402,7 +402,7 @@ mod erc721 {
.unwrap_or(&false)
}
/// Returns true if the AccountId `from` is the owner of token `id`
/// Returns true if the `AccountId` `from` is the owner of token `id`
/// or it has been approved on behalf of the token `id` owner.
fn approved_or_owner(&self, from: Option<AccountId>, id: TokenId) -> bool {
let owner = self.owner_of(id);
......@@ -430,7 +430,7 @@ mod erc721 {
Ok(())
}
/// Increase token counter from the `of` AccountId.
/// Increase token counter from the `of` `AccountId`.
fn increase_counter_of(entry: Entry<AccountId, u32>) {
entry.and_modify(|v| *v += 1).or_insert(1);
}
......
......@@ -36,13 +36,13 @@ pub mod flipper {
Self::new(Default::default())
}
/// Flips the current value of the Flipper's bool.
/// Flips the current value of the Flipper's boolean.
#[ink(message)]
pub fn flip(&mut self) {
self.value = !self.value;
}
/// Returns the current value of the Flipper's bool.
/// Returns the current value of the Flipper's boolean.
#[ink(message)]
pub fn get(&self) -> bool {
self.value
......
......@@ -34,7 +34,7 @@
//!
//! ## Error Handling
//!
//! With the exeception of `execute_transaction` no error conditions are signalled
//! With the exception of `execute_transaction` no error conditions are signalled
//! through return types. Any error or invariant violation triggers a panic and therefore
//! rolls back the transaction.
//!
......@@ -42,12 +42,12 @@
//!
//! The interface is modelled after the popular gnosis multisig wallet. However, there
//! are subtle variations from the interface. For example the `confirm_transaction`
//! will never trigger the execution of a `Transaction` even if the treshold is reached.
//! will never trigger the execution of a `Transaction` even if the threshold is reached.
//! A call of `execute_transaction` is always required. This can be called by anyone.
//!
//! All the messages that are declared as only callable by the wallet must go through
//! the usual submit, confirm, execute cycle as any other transaction that should be
//! called by the wallet. For example to add an owner you would submit a transaction
//! called by the wallet. For example, to add an owner you would submit a transaction
//! that calls the wallets own `add_owner` message through `submit_transaction`.
//!
//! ### Owner Management
......@@ -107,7 +107,7 @@ mod multisig_plain {
/// A wrapper that allows us to encode a blob of bytes.
///
/// We use this to pass the set of untyped (bytes) parameters to the `CallBuilder`.
/// We use this to pass the set of not typed (bytes) parameters to the `CallBuilder`.
struct CallInput<'a>(&'a [u8]);
impl<'a> scale::Encode for CallInput<'a> {
......@@ -143,7 +143,7 @@ mod multisig_plain {
)
)]
pub struct Transaction {
/// The AccountId of the contract that is called in this transaction.
/// The `AccountId` of the contract that is called in this transaction.
pub callee: AccountId,
/// The selector bytes that identifies the function of the callee that should be called.
pub selector: [u8; 4],
......@@ -166,7 +166,7 @@ mod multisig_plain {
#[ink(storage)]
pub struct MultisigPlain {
/// Every entry in this map represents the confirmation of an owner for a
/// transaction. This is effecively a set rather than a map.
/// transaction. This is effectively a set rather than a map.
confirmations: StorageHashMap<(TransactionId, AccountId), ()>,
/// The amount of confirmations for every transaction. This is a redundant
/// information and is kept in order to prevent iterating through the
......@@ -204,7 +204,7 @@ mod multisig_plain {
/// The transaction that was revoked.
#[ink(topic)]
transaction: TransactionId,
/// The owner that sent the revokation.
/// The owner that sent the revocation.
#[ink(topic)]
from: AccountId,
}
......@@ -298,7 +298,7 @@ mod multisig_plain {
/// # Examples
///
/// Since this message must be send by the wallet itself it has to be build as a
/// `Transaction` and dispatched through `submit_transaction` + `invoke_transaction`:
/// `Transaction` and dispatched through `submit_transaction` and `invoke_transaction`:
/// ```no_run
/// use ink_env::{DefaultEnvironment as Env, AccountId, call::{CallParams, Selector}, test::CallData};
/// use multisig_plain::{Transaction, ConfirmationStatus};
......@@ -403,7 +403,7 @@ mod multisig_plain {
self.env().emit_event(RequirementChange { new_requirement });
}
/// Add a new transaction candiate to the contract.
/// Add a new transaction candidate to the contract.
///
/// This also confirms the transaction for the caller. This can be called by any owner.
#[ink(message)]
......
......@@ -25,8 +25,8 @@ use ink_lang as ink;
pub trait FetchRandom {
type ErrorCode = RandomReadErr;
/// Note: this gives the operation a corresponding func_id (1101 in this case),
/// and the chain-side chain_extension will get the func_id to do further operations.
/// Note: this gives the operation a corresponding `func_id` (1101 in this case),
/// and the chain-side chain extension will get the `func_id` to do further operations.
#[ink(extension = 1101, returns_result = false)]
fn fetch_random() -> [u8; 32];
}
......
......@@ -22,11 +22,11 @@ pub trait Flip {
#[ink(constructor)]
fn new(init_value: bool) -> Self;
/// Flips the current value of the Flipper's bool.
/// Flips the current value of the Flipper's boolean.
#[ink(message)]
fn flip(&mut self);
/// Returns the current value of the Flipper's bool.
/// Returns the current value of the Flipper's boolean.
#[ink(message)]
fn get(&self) -> bool;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment