From 89d781ec2ceab9efd1fad7d8fc10c679faa65f52 Mon Sep 17 00:00:00 2001 From: "Abdel @ StarkWare" Date: Mon, 9 Oct 2023 11:54:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20rename=20to=20`tokei`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/book.yml | 2 +- README.md | 20 +++++------ Scarb.toml | 8 ++--- book/book.toml | 6 ++-- book/src/README.md | 8 +++-- book/src/getting-started/build.md | 14 ++++---- src/core/lockup_linear.cairo | 58 +++++++++++++++++-------------- src/libraries/helpers.cairo | 4 +-- src/types/lockup_linear.cairo | 2 +- tests/test_lockup_linear.cairo | 52 +++++++++++++-------------- 10 files changed, 89 insertions(+), 85 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 90fe085..e011b78 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -1,4 +1,4 @@ -name: Za Warudo Book +name: Tokei Book on: push: diff --git a/README.md b/README.md index a6f6129..781aa1d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@

- +

-

⏳ Za Warudo ⏳

+

⏳ Tokei ⏳

✨ 🐺 Starknet ERC20 token streaming protocol 💰⏳, inspired by Sablier. @@ -12,24 +12,24 @@

- Project license + Project license - + Pull Requests welcome - - Read Za Warudo Book + + Read Tokei Book

-## ⚡ About Za Warudo ⚡ +## ⚡ About Tokei ⚡ -Za Warudo is a token streaming protocol, inspired by Sablier, for Starknet. +Tokei is a token streaming protocol, inspired by Sablier, for Starknet. -Read the [Za Warudo Book](https://abdelhamidbakhta.github.io/za-warudo/) to learn more about the project. +Read the [Tokei Book](https://abdelhamidbakhta.github.io/tokei/) to learn more about the project. ## 🛠️ Build @@ -51,7 +51,7 @@ snforge Here are some resources to help you get started: -- [Za Warudo Book](https://abdelhamidbakhta.github.io/za-warudo/) +- [Tokei Book](https://abdelhamidbakhta.github.io/tokei/) - [Cairo Book](https://book.cairo-lang.org/) - [Starknet Book](https://book.starknet.io/) - [Starknet Foundry Book](https://foundry-rs.github.io/starknet-foundry/) diff --git a/Scarb.toml b/Scarb.toml index 89fe97d..8b3a6c2 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -1,13 +1,13 @@ [package] -name = "za_warudo" +name = "tokei" version = "0.1.0" authors = ["Abdelhamid Bakhta <@abdelhamidbakhta>"] license = "MIT" keywords = ["starknet", "vesting"] description = "✨ 🐺 Starknet ERC20 token vesting smart contracts 💰⏳" -documentation = "https://github.com/abdelhamidbakhta/za-warudo" -homepage = "https://github.com/abdelhamidbakhta/za-warudo" -repository = "https://github.com/abdelhamidbakhta/za-warudo" +documentation = "https://github.com/abdelhamidbakhta/tokei" +homepage = "https://github.com/abdelhamidbakhta/tokei" +repository = "https://github.com/abdelhamidbakhta/tokei" [[target.starknet-contract]] sierra = true diff --git a/book/book.toml b/book/book.toml index a380707..a031546 100644 --- a/book/book.toml +++ b/book/book.toml @@ -3,11 +3,11 @@ authors = ["@abdelhamidbakhta"] language = "en" multilingual = false src = "src" -title = "Za Warudo Book" +title = "Tokei Book" [output.html] -git-repository-url = "https://github.com/abdelhamidbakhta/za-warudo" -edit-url-template = "https://github.com/abdelhamidbakhta/za-warudo/book/{path}" +git-repository-url = "https://github.com/abdelhamidbakhta/tokei" +edit-url-template = "https://github.com/abdelhamidbakhta/tokei/book/{path}" [output.html.playground] runnable = false diff --git a/book/src/README.md b/book/src/README.md index ab962cc..fe1d7da 100644 --- a/book/src/README.md +++ b/book/src/README.md @@ -1,5 +1,7 @@ -# ⏳ Za Warudo ⏳ +# ⏳ Tokei ⏳ -Za Warudo is a token streaming protocol, inspired by Sablier, for Starknet. +Tokei is a token streaming protocol, inspired by Sablier, for Starknet. -![Za Warudo](./assets/za-warudo-hello.gif) +Tokei means "clock" in Japanese. + +![Tokei](./assets/tokei-hello.gif) diff --git a/book/src/getting-started/build.md b/book/src/getting-started/build.md index 2a0d098..4b79cce 100644 --- a/book/src/getting-started/build.md +++ b/book/src/getting-started/build.md @@ -12,11 +12,11 @@ Sample output: ```shell tree target/dev -├── za_warudo.starknet_artifacts.json -├── za_warudo_ERC20.casm.json -├── za_warudo_ERC20.sierra.json -├── za_warudo_ERC721.casm.json -├── za_warudo_ERC721.sierra.json -├── za_warudo_ZaWarudoLockupLinear.casm.json -└── za_warudo_ZaWarudoLockupLinear.sierra.json +├── tokei.starknet_artifacts.json +├── tokei_ERC20.casm.json +├── tokei_ERC20.sierra.json +├── tokei_ERC721.casm.json +├── tokei_ERC721.sierra.json +├── tokei_TokeiLockupLinear.casm.json +└── tokei_TokeiLockupLinear.sierra.json ``` diff --git a/src/core/lockup_linear.cairo b/src/core/lockup_linear.cairo index 1c727c6..64e599e 100644 --- a/src/core/lockup_linear.cairo +++ b/src/core/lockup_linear.cairo @@ -1,4 +1,4 @@ -//! Main contract of Za Warudo protocol. +//! Main contract of Tokei protocol. // ************************************************************************* // IMPORTS @@ -9,27 +9,31 @@ use core::traits::Into; use starknet::{ContractAddress, ClassHash}; // Local imports. -use za_warudo::types::lockup_linear::{Range, Broker}; - -// ███████╗ █████╗ ██╗ ██╗ █████╗ ██████╗ ██╗ ██╗██████╗ ██████╗ -// ╚══███╔╝██╔══██╗ ██║ ██║██╔══██╗██╔══██╗██║ ██║██╔══██╗██╔═══██╗ -// ███╔╝ ███████║ ██║ █╗ ██║███████║██████╔╝██║ ██║██║ ██║██║ ██║ -// ███╔╝ ██╔══██║ ██║███╗██║██╔══██║██╔══██╗██║ ██║██║ ██║██║ ██║ -// ███████╗██║ ██║ ╚███╔███╔╝██║ ██║██║ ██║╚██████╔╝██████╔╝╚██████╔╝ -// ╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ - -// ██╗ ██████╗ ██████╗██╗ ██╗██╗ ██╗██████╗ ██╗ ██╗███╗ ██╗███████╗ █████╗ ██████╗ -// ██║ ██╔═══██╗██╔════╝██║ ██╔╝██║ ██║██╔══██╗ ██║ ██║████╗ ██║██╔════╝██╔══██╗██╔══██╗ -// ██║ ██║ ██║██║ █████╔╝ ██║ ██║██████╔╝ ██║ ██║██╔██╗ ██║█████╗ ███████║██████╔╝ -// ██║ ██║ ██║██║ ██╔═██╗ ██║ ██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██╔══██║██╔══██╗ -// ███████╗╚██████╔╝╚██████╗██║ ██╗╚██████╔╝██║ ███████╗██║██║ ╚████║███████╗██║ ██║██║ ██║ -// ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ +use tokei::types::lockup_linear::{Range, Broker}; + +// ______ ____ __ __ ______ ____ +// /_ __// __ \ / //_/ / ____// _/ +// / / / / / // ,< / __/ / / +// / / / /_/ // /| | / /___ _/ / +// /_/ \____//_/ |_|/_____//___/ + +// __ ____ ______ __ __ __ __ ____ +// / / / __ \ / ____// //_// / / // __ \ +// / / / / / // / / ,< / / / // /_/ / +// / /___/ /_/ // /___ / /| |/ /_/ // ____/ +// /_____/\____/ \____//_/ |_|\____//_/ + +// __ ____ _ __ ______ ___ ____ +// / / / _// | / // ____// | / __ \ +// / / / / / |/ // __/ / /| | / /_/ / +// / /___ _/ / / /| // /___ / ___ | / _, _/ +// /_____//___//_/ |_//_____//_/ |_|/_/ |_| // ************************************************************************* -// Interface of the `ZaWarudoLockupLinear` contract. +// Interface of the `TokeiLockupLinear` contract. // ************************************************************************* #[starknet::interface] -trait IZaWarudoLockupLinear { +trait ITokeiLockupLinear { /// Create a new stream. /// # Arguments /// * `sender` - The address streaming the assets, with the ability to cancel the stream. @@ -55,7 +59,7 @@ trait IZaWarudoLockupLinear { } #[starknet::contract] -mod ZaWarudoLockupLinear { +mod TokeiLockupLinear { // ************************************************************************* // IMPORTS // ************************************************************************* @@ -69,10 +73,10 @@ mod ZaWarudoLockupLinear { use traits::Into; use debug::PrintTrait; // Local imports. - use za_warudo::types::lockup_linear::{Range, Broker, LockupLinearStream}; - use za_warudo::types::lockup::LockupAmounts; - use za_warudo::tokens::erc721::{ERC721, IERC721}; - use za_warudo::libraries::helpers; + use tokei::types::lockup_linear::{Range, Broker, LockupLinearStream}; + use tokei::types::lockup::LockupAmounts; + use tokei::tokens::erc721::{ERC721, IERC721}; + use tokei::libraries::helpers; // ************************************************************************* // STORAGE @@ -126,7 +130,7 @@ mod ZaWarudoLockupLinear { // Initialize as ERC-721 contract. let mut state: ERC721::ContractState = ERC721::unsafe_new_contract_state(); IERC721::initializer( - ref state, 'Za Warudo Lockup Linear NFT', 'ZW-LOCKUP-LIN', get_contract_address() + ref state, 'Tokei Lockup Linear NFT', 'ZW-LOCKUP-LIN', get_contract_address() ); } @@ -135,7 +139,7 @@ mod ZaWarudoLockupLinear { // EXTERNAL FUNCTIONS // ************************************************************************* #[external(v0)] - impl ZaWarudoLockupLinear of super::IZaWarudoLockupLinear { + impl TokeiLockupLinear of super::ITokeiLockupLinear { /// Create a new stream. /// # Arguments /// * `sender` - The address streaming the assets, with the ability to cancel the stream. @@ -158,7 +162,7 @@ mod ZaWarudoLockupLinear { range: Range, broker: Broker, ) -> u64 { - // Safe Interactions: query the protocol fee. This is safe because it's a known Za Warudo contract that does + // Safe Interactions: query the protocol fee. This is safe because it's a known Tokei contract that does // not call other unknown contracts. // TODO: implement. let protocol_fee = 0; @@ -233,7 +237,7 @@ mod ZaWarudoLockupLinear { } #[external(v0)] - impl ZaWarudoLockupLinearERC721 of IERC721 { + impl TokeiLockupLinearERC721 of IERC721 { fn initializer( ref self: ContractState, name_: felt252, symbol_: felt252, admin: ContractAddress ) {} diff --git a/src/libraries/helpers.cairo b/src/libraries/helpers.cairo index 526ecbb..41ca086 100644 --- a/src/libraries/helpers.cairo +++ b/src/libraries/helpers.cairo @@ -6,8 +6,8 @@ use zeroable::Zeroable; // Local imports. -use za_warudo::types::lockup::CreateAmounts; -use za_warudo::libraries::errors; +use tokei::types::lockup::CreateAmounts; +use tokei::libraries::errors; //Checks that neither fee is greater than `max_fee`, and then calculates the protocol fee amount, the /// broker fee amount, and the deposit amount from the total amount. diff --git a/src/types/lockup_linear.cairo b/src/types/lockup_linear.cairo index b4e412e..4162f08 100644 --- a/src/types/lockup_linear.cairo +++ b/src/types/lockup_linear.cairo @@ -10,7 +10,7 @@ use traits::{TryInto, Into}; use starknet::ContractAddress; // Local imports. -use za_warudo::types::lockup::LockupAmounts; +use tokei::types::lockup::LockupAmounts; /// Represent a Lockup Linear Stream. #[derive(Drop, starknet::Store, Serde)] diff --git a/tests/test_lockup_linear.cairo b/tests/test_lockup_linear.cairo index 3d9246c..2eae868 100644 --- a/tests/test_lockup_linear.cairo +++ b/tests/test_lockup_linear.cairo @@ -20,11 +20,11 @@ use snforge_std::{declare, start_prank, stop_prank, ContractClassTrait}; // Local imports. -use za_warudo::core::lockup_linear::{ - IZaWarudoLockupLinearSafeDispatcher, IZaWarudoLockupLinearSafeDispatcherTrait +use tokei::core::lockup_linear::{ + ITokeiLockupLinearSafeDispatcher, ITokeiLockupLinearSafeDispatcherTrait }; -use za_warudo::types::lockup_linear::{Range, Broker}; -use za_warudo::tokens::erc721::{IERC721SafeDispatcher, IERC721SafeDispatcherTrait}; +use tokei::types::lockup_linear::{Range, Broker}; +use tokei::tokens::erc721::{IERC721SafeDispatcher, IERC721SafeDispatcherTrait}; /// TODO: Implement actual test and change the name of this function. #[test] @@ -34,7 +34,7 @@ fn given_normal_conditions_when_create_with_range_then_expected_results() { // ********************************************************************************************* let caller_address = contract_address_const::<'caller'>(); - let (za_warudo) = setup(caller_address); + let (tokei) = setup(caller_address); // ********************************************************************************************* // * TEST LOGIC * // ********************************************************************************************* @@ -54,14 +54,14 @@ fn given_normal_conditions_when_create_with_range_then_expected_results() { let broker = Broker { account: broker_account, fee: broker_fee, }; // Actual test. - let stream_id = za_warudo + let stream_id = tokei .create_with_range(sender, recipient, total_amount, asset, cancelable, range, broker,) .unwrap(); // Assertions. assert(stream_id == 1, 'wrong stream id'); - let stream_nft = IERC721SafeDispatcher { contract_address: za_warudo.contract_address }; + let stream_nft = IERC721SafeDispatcher { contract_address: tokei.contract_address }; // Check that the stream nft was minted to the recipient. assert(stream_nft.owner_of(stream_id.into()).unwrap() == recipient, 'wrong stream nft owner'); @@ -70,49 +70,47 @@ fn given_normal_conditions_when_create_with_range_then_expected_results() { // ********************************************************************************************* // * TEARDOWN * // ********************************************************************************************* - teardown(za_warudo); + teardown(tokei); } /// Utility function to setup the test environment. -fn setup(caller_address: ContractAddress) -> (IZaWarudoLockupLinearSafeDispatcher,) { +fn setup(caller_address: ContractAddress) -> (ITokeiLockupLinearSafeDispatcher,) { // Setup the contracts. - let (za_warudo,) = setup_contracts(caller_address); + let (tokei,) = setup_contracts(caller_address); // Prank the caller address. - prepare_contracts(caller_address, za_warudo,); + prepare_contracts(caller_address, tokei,); // Return the caller address and the contract interfaces. - (za_warudo,) + (tokei,) } // Utility function to prank the caller address -fn prepare_contracts( - caller_address: ContractAddress, za_warudo: IZaWarudoLockupLinearSafeDispatcher, -) { - // Prank the caller address for calls to `ZaWarudoLockupLinear` contract. - start_prank(za_warudo.contract_address, caller_address); +fn prepare_contracts(caller_address: ContractAddress, tokei: ITokeiLockupLinearSafeDispatcher,) { + // Prank the caller address for calls to `TokeiLockupLinear` contract. + start_prank(tokei.contract_address, caller_address); } /// Utility function to teardown the test environment. -fn teardown(za_warudo: IZaWarudoLockupLinearSafeDispatcher,) { - stop_prank(za_warudo.contract_address); +fn teardown(tokei: ITokeiLockupLinearSafeDispatcher,) { + stop_prank(tokei.contract_address); } /// Setup required contracts. -fn setup_contracts(caller_address: ContractAddress) -> (IZaWarudoLockupLinearSafeDispatcher,) { +fn setup_contracts(caller_address: ContractAddress) -> (ITokeiLockupLinearSafeDispatcher,) { // Deploy the role store contract. - let za_warudo_address = deploy_za_warudo(caller_address); + let tokei_address = deploy_tokei(caller_address); // Create a role store dispatcher. - let za_warudo = IZaWarudoLockupLinearSafeDispatcher { contract_address: za_warudo_address }; + let tokei = ITokeiLockupLinearSafeDispatcher { contract_address: tokei_address }; // Return the caller address and the contract interfaces. - (za_warudo,) + (tokei,) } -/// Utility function to deploy a `ZaWarudoLockupLinear` contract and return its address. -fn deploy_za_warudo(initial_admin: ContractAddress) -> ContractAddress { - let za_warudo_contract = declare('ZaWarudoLockupLinear'); +/// Utility function to deploy a `TokeiLockupLinear` contract and return its address. +fn deploy_tokei(initial_admin: ContractAddress) -> ContractAddress { + let tokei_contract = declare('TokeiLockupLinear'); let mut constructor_calldata = array![initial_admin.into()]; - za_warudo_contract.deploy(@constructor_calldata).unwrap() + tokei_contract.deploy(@constructor_calldata).unwrap() }