From 4bfedc6f6467b568d9028467d376d6a11806754e Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:30:25 +0200 Subject: [PATCH 01/11] Update CODE_OF_CONDUCT.md --- docs/CODE_OF_CONDUCT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md index db7c4ad3..b00b2bb7 100644 --- a/docs/CODE_OF_CONDUCT.md +++ b/docs/CODE_OF_CONDUCT.md @@ -25,7 +25,7 @@ Examples of unacceptable behavior by participants include: - Public or private harassment - Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting +- Other conduct that could reasonably be considered inappropriate in a professional setting ## Our Responsibilities @@ -34,7 +34,7 @@ expected to take appropriate and fair corrective action in response to any insta behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, -code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, +code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. From 14fc244647acf147461e4f995d0390b3c1f521be Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:33:55 +0200 Subject: [PATCH 02/11] Update spec.md --- docs/spec.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/spec.md b/docs/spec.md index 00479371..2e319df9 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -517,7 +517,7 @@ fn unstake_action( ) -> u128 ``` #### description -Executes the intent to exit the stake if enough time have passed. +Executes the intent to exit the stake if enough time has passed. Transfers the funds back to the staker. Return the amount of tokens transferred back to the staker. #### emits @@ -534,8 +534,8 @@ Return the amount of tokens transferred back to the staker. 6. [FINAL\_STAKER\_INDEX\_ALREADY\_SET](#final_staker_index_already_set) #### pre-condition 1. Staking contract is unpaused. -2. Staker exist and requested to unstake. -3. Enough time have passed from the unstake intent call. +2. Staker exists and requested to unstake. +3. Enough time has passed from the unstake intent call. #### access control Any address can execute. #### logic @@ -645,7 +645,7 @@ fn remove_from_delegation_pool_action( ) ``` #### description -Execute the intent to remove funds from pool if enough time have passed. +Execute the intent to remove funds from pool if enough time has passed. Transfers the funds to the pool contract. #### emits 1. [Remove From Delegation Pool Action](#remove-from-delegation-pool-action) @@ -656,7 +656,7 @@ Transfers the funds to the pool contract. #### pre-condition 1. Staking contract is unpaused. 2. Removal intent request with the given `identifier` have been sent before. -3. Enough time have passed since the intent request. +3. Enough time has passed since the intent request. #### access control Any address can execute. #### logic @@ -1258,7 +1258,7 @@ fn exit_delegation_pool_action( ) -> u128 ``` #### description -Executes the intent to exit the stake if enough time have passed. Transfers the funds back to the pool member. +Executes the intent to exit the stake if enough time has passed. Transfers the funds back to the pool member. Return the amount of tokens transferred back to the pool member. #### emits 1. [Pool Member Reward Claimed](#pool-member-reward-claimed) @@ -1269,8 +1269,8 @@ Return the amount of tokens transferred back to the pool member. 3. [INTENT\_WINDOW\_NOT\_FINISHED](#intent_window_not_finished) 4. [CONTRACT\_IS\_PAUSED](#contract_is_paused) #### pre-condition -1. Pool member exist and requested to unstake. -2. Enough time have passed from the delegation pool exit intent call. +1. Pool member exists and requested to unstake. +2. Enough time has passed from the delegation pool exit intent call. #### access control Any address can execute. #### logic From 74847a7a06bf83564bfc07c58621999a5a39c87b Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:35:55 +0200 Subject: [PATCH 03/11] Update ProxySupport.sol --- .../staking/L1/starkware/solidity/interfaces/ProxySupport.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/apps/staking/L1/starkware/solidity/interfaces/ProxySupport.sol b/workspace/apps/staking/L1/starkware/solidity/interfaces/ProxySupport.sol index 95766e11..a2a868d4 100644 --- a/workspace/apps/staking/L1/starkware/solidity/interfaces/ProxySupport.sol +++ b/workspace/apps/staking/L1/starkware/solidity/interfaces/ProxySupport.sol @@ -9,10 +9,10 @@ import "starkware/solidity/interfaces/ContractInitializer.sol"; /** This contract contains the code commonly needed for a contract to be deployed behind an upgradability proxy. - It perform the required semantics of the proxy pattern, + It performs the required semantics of the proxy pattern, but in a generic manner. Instantiation of the Governance and of the ContractInitializer, that are the app specific - part of initialization, has to be done by the using contract. + part of initialization has to be done by the using contract. */ abstract contract ProxySupport is MGovernance, BlockDirectCall, ContractInitializer { using Addresses for address; From f8b5144d6965d681dd1de6f8d4750d3d077fc6d3 Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:39:05 +0200 Subject: [PATCH 04/11] Update RolesLib.sol --- .../apps/staking/L1/starkware/solidity/libraries/RolesLib.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/apps/staking/L1/starkware/solidity/libraries/RolesLib.sol b/workspace/apps/staking/L1/starkware/solidity/libraries/RolesLib.sol index 9aff0c76..8d84f76d 100644 --- a/workspace/apps/staking/L1/starkware/solidity/libraries/RolesLib.sol +++ b/workspace/apps/staking/L1/starkware/solidity/libraries/RolesLib.sol @@ -92,9 +92,9 @@ library RolesLib { } if (securityRolesInitialized()) { - // If SecurityAdmin initialized, + // If SecurityAdmin is initialized, // then provisionalSecAdmin must already be a `SecurityAdmin`. - // If it's not initilized - initialize it. + // If it's not initialized - initialize it. require( AccessControl.hasRole(SECURITY_ADMIN, provisionalSecAdmin), "SECURITY_ROLES_ALREADY_INITIALIZED" From 1e5f8932bb6d20e10b7440e2b743c7eb3fed9e0e Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:40:11 +0200 Subject: [PATCH 05/11] Update MintManager.sol --- .../apps/staking/L1/starkware/solidity/stake/MintManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/L1/starkware/solidity/stake/MintManager.sol b/workspace/apps/staking/L1/starkware/solidity/stake/MintManager.sol index 7e0d5d4d..8d60451d 100644 --- a/workspace/apps/staking/L1/starkware/solidity/stake/MintManager.sol +++ b/workspace/apps/staking/L1/starkware/solidity/stake/MintManager.sol @@ -109,7 +109,7 @@ contract MintManager is IMintManager, Identity, ProxySupportImpl, PeriodMintLimi } /** - Unegister an eligible token minter. + Unregister an eligible token minter. Callable only by the app governor or a security agent/admin. */ function revokeTokenMinter(address token, address minter) external onlySecurityRole { From b66a59250a8b9f70b7a7df85fff4d0db5a7d5b1f Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:42:08 +0200 Subject: [PATCH 06/11] Update IStarknetMessaging.sol --- .../L1/starkware/starknet/solidity/IStarknetMessaging.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/L1/starkware/starknet/solidity/IStarknetMessaging.sol b/workspace/apps/staking/L1/starkware/starknet/solidity/IStarknetMessaging.sol index 4fda7291..be8c39d2 100644 --- a/workspace/apps/staking/L1/starkware/starknet/solidity/IStarknetMessaging.sol +++ b/workspace/apps/staking/L1/starkware/starknet/solidity/IStarknetMessaging.sol @@ -42,7 +42,7 @@ interface IStarknetMessaging is IStarknetMessagingEvents { /** Sends a message to an L2 contract. - This function is payable, the payed amount is the message fee. + This function is payable, the paid amount is the message fee. Returns the hash of the message and the nonce of the message. */ From 325cb18caf2a0de9c43ff37d1bd81a4440fa589b Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:43:11 +0200 Subject: [PATCH 07/11] Update Math.sol --- .../staking/L1/third_party/open_zeppelin/utils/math/Math.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/L1/third_party/open_zeppelin/utils/math/Math.sol b/workspace/apps/staking/L1/third_party/open_zeppelin/utils/math/Math.sol index a2ecf687..6e78b814 100644 --- a/workspace/apps/staking/L1/third_party/open_zeppelin/utils/math/Math.sol +++ b/workspace/apps/staking/L1/third_party/open_zeppelin/utils/math/Math.sol @@ -165,7 +165,7 @@ library Math { // `msb(a) <= a < 2*msb(a)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. - // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a + // Using an algorithm similar to the msb computation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; From cb2fd2bc9fc40e23debfc5ddafd9c7595df3e74f Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:43:47 +0200 Subject: [PATCH 08/11] Update Strings.sol --- .../apps/staking/L1/third_party/open_zeppelin/utils/Strings.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/L1/third_party/open_zeppelin/utils/Strings.sol b/workspace/apps/staking/L1/third_party/open_zeppelin/utils/Strings.sol index 39e0cf12..e4c4bc75 100644 --- a/workspace/apps/staking/L1/third_party/open_zeppelin/utils/Strings.sol +++ b/workspace/apps/staking/L1/third_party/open_zeppelin/utils/Strings.sol @@ -14,7 +14,7 @@ library Strings { * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { - // Inspired by OraclizeAPI's implementation - MIT licence + // Inspired by OraclizeAPI's implementation - MIT license // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { From bed33b7d41f98e24735f539c0243f15e4c39d034 Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:47:48 +0200 Subject: [PATCH 09/11] Update reward_supplier.cairo --- .../staking/contracts/src/reward_supplier/reward_supplier.cairo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/contracts/src/reward_supplier/reward_supplier.cairo b/workspace/apps/staking/contracts/src/reward_supplier/reward_supplier.cairo index 03e294ae..8cac695a 100644 --- a/workspace/apps/staking/contracts/src/reward_supplier/reward_supplier.cairo +++ b/workspace/apps/staking/contracts/src/reward_supplier/reward_supplier.cairo @@ -55,7 +55,7 @@ pub mod RewardSupplier { unclaimed_rewards: Amount, // The amount of tokens requested from L1. l1_pending_requested_amount: Amount, - // The amount of tokens that is requested from L1 in a single message. + // The amount of tokens that are requested from L1 in a single message. base_mint_amount: Amount, minting_curve_dispatcher: IMintingCurveDispatcher, staking_contract: ContractAddress, From 5001932ba9f05abd3c2ee9cfe2a16c3faee6b99a Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:48:15 +0200 Subject: [PATCH 10/11] Update test.cairo --- workspace/apps/staking/contracts/src/reward_supplier/test.cairo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/apps/staking/contracts/src/reward_supplier/test.cairo b/workspace/apps/staking/contracts/src/reward_supplier/test.cairo index 77876eda..b2313002 100644 --- a/workspace/apps/staking/contracts/src/reward_supplier/test.cairo +++ b/workspace/apps/staking/contracts/src/reward_supplier/test.cairo @@ -107,7 +107,7 @@ fn test_claim_rewards() { cfg.reward_supplier.minting_curve_contract = minting_curve_contract; // Use the reward supplier contract state to claim rewards. let mut state = initialize_reward_supplier_state_from_cfg(:token_address, :cfg); - // Fund the the reward supplier contract. + // Fund the reward supplier contract. fund(sender: cfg.test_info.owner_address, recipient: test_address(), :amount, :token_address); // Update the unclaimed rewards for testing purposes. state.unclaimed_rewards.write(amount); From 57b704207a3c8765fa8e5e5a0e2224fd4a45370e Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 16 Dec 2024 20:56:07 +0200 Subject: [PATCH 11/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e70b863..ff81f73b 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Following [Starknet SNIP 18](https://community.starknet.io/t/snip-18-staking-s-f Staking is a work in progress. ## Dependencies -The project is build with [Turbo repo](https://turbo.build/) and [pnpm](https://pnpm.io/). +The project is built with [Turbo repo](https://turbo.build/) and [pnpm](https://pnpm.io/). Turbo's installation process will also install the cairo dependencies such as [Scarb](https://docs.swmansion.com/scarb/) and [Starknet foundry](https://foundry-rs.github.io/starknet-foundry/index.html). ## Installation