From cbc21fca4b38ca8a51a276b2cf6eb0d83eb0b73f Mon Sep 17 00:00:00 2001 From: rajkharvar Date: Fri, 7 Nov 2025 16:52:41 +0530 Subject: [PATCH 1/2] chore: add docs to execute contract action using blockexplorer --- docs/delegate.md | 130 ++++++++++++++++++++++++- docs/initiate-withdraw.md | 192 +++++++++++++++++++++++++++++++++++++ docs/reset-lock.md | 196 ++++++++++++++++++++++++++++++++++++++ docs/stake.md | 188 ++++++++++++++++++++++++++++++++++++ docs/unstake.md | 187 ++++++++++++++++++++++++++++++++++++ docs/withdraw.md | 164 +++++++++++++++++++++++++++++++ 6 files changed, 1056 insertions(+), 1 deletion(-) diff --git a/docs/delegate.md b/docs/delegate.md index b0b05e4..e3421f7 100644 --- a/docs/delegate.md +++ b/docs/delegate.md @@ -17,7 +17,7 @@ In order to delegate, you will also need some RAZOR tokens on Europa Defi Hub. Y **Note**: _You can get the stakers sRAZOR address by clicking on the `+` icon on that stakers delegate/unstake modal._ -## Delegation on Razorscan {#delegation-on-razorscan} +## Using Razorscan (Recommended for beginners) {#delegation-on-razorscan} ### Step 1 {#step-1} @@ -60,3 +60,131 @@ On the Metamask popup click on “Confirm”. There will be an update on the web Click on your connected wallet address to get information on your actions. ![Screenshot](/img//delegate/delegation_step6.png) + +## Using SKALE Block Explorer (Alternative method) {#delegation-block-explorer} + +This method allows you to interact directly with the StakeManager smart contract through the SKALE Block Explorer. This is recommended for advanced users who are comfortable with direct contract interaction. + +### Prerequisites {#block-explorer-prerequisites} + +Before delegating via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **RAZOR tokens** on Europa Defi Hub (bridge from Ethereum via [SKALE Portal](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20)) +4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +5. **Staker ID** of the validator you want to delegate to + +### Contract Addresses {#contract-addresses} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) +- RAZOR Token: [`0xCA46B70cA3c510Ce9D0c43D25817032e2F5354c0`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xCA46B70cA3c510Ce9D0c43D25817032e2F5354c0) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) +- RAZOR Token: [`0x99Be5a5749bA2bccfC4Bb6584cA0E405A16586C4`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0x99Be5a5749bA2bccfC4Bb6584cA0E405A16586C4) + +### Step-by-Step Instructions {#block-explorer-steps} + +#### Step 1: Find the Staker ID {#find-staker-id} + +First, you need to know the Staker ID of the validator you want to delegate to. You can find this on [Razorscan](https://razorscan.io/staking) by looking at the staker list, or query it from the contract: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `getStakerId` function +4. Enter the validator's wallet address +5. Click "Query" - the result is the Staker ID (note: returns 0 if the address is not a staker) + +#### Step 2: Approve RAZOR Tokens {#approve-tokens} + +Before delegating, you must approve the StakeManager contract to spend your RAZOR tokens: + +1. Visit the **RAZOR Token contract** on the block explorer (use links above) +2. Click "Connect Wallet" and approve the Metamask connection +3. Verify your wallet is connected and you're on the correct network (Europa Defi Hub) +4. Navigate to the **"Write Contract"** tab +5. Find the **`approve`** function +6. Fill in the parameters: + - **spender (address)**: Enter the StakeManager contract address: + - Mainnet: `0xd492408e4901CF658c7874285984F6D5Db648D1E` + - Testnet: `0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012` + - **amount (uint256)**: Enter the amount in wei (e.g., for 1000 RAZOR, enter `1000000000000000000000`) +7. Click "Write" and confirm the transaction in Metamask +8. Wait for the transaction to be confirmed + +**Note**: _1 RAZOR = 10^18 wei. To convert: multiply your RAZOR amount by 1000000000000000000_ + +#### Step 3: Navigate to StakeManager Contract {#navigate-stakemanager} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Ensure your wallet is still connected (if not, click "Connect Wallet" again) + +#### Step 4: Execute Delegate Function {#execute-delegate} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`delegate`** function +3. Fill in the parameters: + - **stakerId (uint32)**: Enter the Staker ID from Step 1 (e.g., `42`) + - **amount (uint256)**: Enter the delegation amount in wei (e.g., for 1000 RAZOR, enter `1000000000000000000000`) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. Click "Confirm" in Metamask + +**Important Notes:** +- The staker must have **delegation enabled** (`acceptDelegation = true`) +- You cannot delegate to yourself if you're already a staker +- The staker must not be slashed +- Ensure you've completed the token approval in Step 2 + +#### Step 5: Verify Transaction {#verify-transaction} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your delegation by: + - Checking the transaction logs for a `Delegated` event + - Visiting your wallet on [Razorscan](https://razorscan.io/) to see your delegation + +### Common Issues and Troubleshooting {#troubleshooting} + +**Transaction fails with "Delegetion not accpected"** +- The staker has not enabled delegation acceptance +- Choose a different staker who accepts delegation + +**Transaction fails with "ERC20: insufficient allowance"** +- You didn't complete Step 2 (token approval), or approved an insufficient amount +- Go back to Step 2 and approve the correct amount + +**Transaction fails with "Staker cannot delegate themself"** +- You're trying to delegate to your own staker ID +- Stakers cannot delegate to themselves; they should use the `stake` function instead + +**Transaction fails with "Staker is slashed"** +- The staker you're trying to delegate to has been slashed +- Choose a different staker + +**Invalid Staker ID** +- Double-check the Staker ID is correct +- Ensure the staker exists by querying `getStaker` with the ID + +### Wei Conversion Helper {#wei-conversion} + +To convert RAZOR amounts to wei for the smart contract: + +- 100 RAZOR = `100000000000000000000` wei +- 1000 RAZOR = `1000000000000000000000` wei +- 5000 RAZOR = `5000000000000000000000` wei + +Formula: **RAZOR amount × 1,000,000,000,000,000,000** + +### Related Operations {#related-operations} + +After delegating, you may want to: +- [Unstake](./unstake.md) - Begin the unstaking process +- [Withdraw](./withdraw.md) - Complete withdrawal after unstaking period diff --git a/docs/initiate-withdraw.md b/docs/initiate-withdraw.md index 4512d20..90a7863 100644 --- a/docs/initiate-withdraw.md +++ b/docs/initiate-withdraw.md @@ -4,6 +4,8 @@ title: Initiate Withdraw Before withdrawing, user needs to initiate withdraw to lock the RAZOR amount that needs to be withdraw. +## Using Razorscan (Recommended for beginners) {#initiate-withdraw-razorscan} + ### Step 1 {#step-1} Visit @@ -39,3 +41,193 @@ Once the transaction is successful, [Withdraw](./withdraw.md) will need to be ca ![Screenshot](/img/initiate-withdraw/Initiate_Withdraw_step5.png) **Note**: _To get the exact values of the lock periods check Governance [here](https://razorscan.io/governance/values)_. + +## Using SKALE Block Explorer (Alternative method) {#initiate-withdraw-block-explorer} + +This method allows you to initiate withdrawal directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is recommended for advanced users who are comfortable with direct contract interaction. + +### Prerequisites {#block-explorer-prerequisites-initiate} + +Before initiating withdrawal via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **Completed unstaking** - You must have called [unstake](./unstake.md) previously +5. **Unstake lock expired** - The `unstakeLockPeriod` must have passed +6. **Within initiation window** - You must be within the `withdrawInitiationPeriod` +7. **Correct state** - Current state must NOT be Propose or Dispute (must be Commit state) + +### Contract Addresses {#contract-addresses-initiate} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) + +### Step-by-Step Instructions {#block-explorer-steps-initiate} + +#### Step 1: Verify Prerequisites {#verify-prerequisites} + +Before calling initiate withdraw, verify: + +**Check Unstake Lock Status:** +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `locks` function +4. Enter your parameters: + - **address**: Your wallet address + - **tokenAddress**: The sRZR token address for your staker + - **lockType**: `0` (for Unstake lock) +5. Click "Query" and check the result: + - `amount`: Should be greater than 0 + - `unlockAfter`: Should be less than or equal to current epoch + +**Check Current State:** +1. Find the `getState` function in the Read Contract tab +2. Enter `buffer` parameter (usually `5`) +3. Click "Query" - the result should be `0` (Commit state) +4. If it's `1` (Propose) or `2` (Dispute), wait a few minutes and try again + +**Important**: Do NOT call initiate withdraw during Propose or Dispute states, as it will fail. + +#### Step 2: Find Your Staker ID {#find-staker-id-initiate} + +You need the Staker ID for your staker: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `getStakerId` function +4. Enter your wallet address +5. Click "Query" - the result is your Staker ID + +Alternatively, you can find your Staker ID on [Razorscan](https://razorscan.io/staking). + +#### Step 3: Navigate to StakeManager Contract {#navigate-stakemanager-initiate} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Click "Connect Wallet" and approve the Metamask connection +3. Verify your wallet is connected and you're on the correct network (Europa Defi Hub) + +#### Step 4: Execute Initiate Withdraw Function {#execute-initiate-withdraw} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`initiateWithdraw`** function +3. Fill in the parameters: + - **stakerId (uint32)**: Enter your Staker ID from Step 2 (e.g., `42`) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. Click "Confirm" in Metamask + +**Important Notes:** +- This function only requires the Staker ID parameter +- It will burn your locked sRZR tokens and lock equivalent RAZOR tokens +- The RAZOR tokens will be locked for `withdrawLockPeriod` (currently 300 epochs) +- Must be called during Commit state (not Propose or Dispute) + +#### Step 5: Verify Transaction {#verify-transaction-initiate} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your initiate withdraw by: + - Checking the transaction logs for a `WithdrawInitiated` event + - Visiting your wallet on [Razorscan](https://razorscan.io/) to see your withdraw lock status + - Querying the `locks` function with `lockType: 1` (Withdraw lock) to see your new lock + +#### Step 6: Next Steps {#next-steps-initiate} + +After successfully initiating withdrawal: + +1. **Wait for withdrawLockPeriod** (currently 300 epochs) to pass +2. **Call [Withdraw](./withdraw.md)** to claim your RAZOR tokens +3. Track your lock status on [Razorscan](https://razorscan.io/) + +### Common Issues and Troubleshooting {#troubleshooting-initiate} + +**Transaction fails with "Unstake: NA Propose"** +- Current state is Propose +- Wait a few minutes for the state to change to Commit +- Check the current state using the method in Step 1 + +**Transaction fails with "Unstake: NA Dispute"** +- Current state is Dispute +- Wait a few minutes for the state to change to Commit +- Check the current state using the method in Step 1 + +**Transaction fails with "Did not unstake"** +- You don't have an active unstake lock +- You must call [unstake](./unstake.md) first + +**Transaction fails with "Withdraw epoch not reached"** +- The unstake lock period hasn't expired yet +- Wait until the `unlockAfter` epoch has passed +- Check your lock status using the method in Step 1 + +**Transaction fails with "Initiation Period Passed"** +- You missed the withdrawal initiation window +- The unstake lock has expired beyond the `withdrawInitiationPeriod` +- You must call [Reset Lock](./reset-lock.md) (which incurs a penalty) + +**Transaction fails with "Withdraw lock present"** +- You already have an active withdraw lock +- Complete the [Withdraw](./withdraw.md) process first + +**Transaction fails with "staker doesnt exist"** +- Invalid Staker ID +- Double-check your Staker ID is correct + +**Transaction fails with "No razor to withdraw"** +- The calculated RAZOR amount is 0 +- This shouldn't happen if you followed the unstake process correctly + +### Understanding the Withdrawal Process {#understanding-withdrawal} + +The complete withdrawal process has 3 steps: + +1. **[Unstake](./unstake.md)**: Lock sRZR tokens for `unstakeLockPeriod` (300 epochs) +2. **Initiate Withdraw** (this step): Burn sRZR and lock RAZOR for `withdrawLockPeriod` (300 epochs) +3. **[Withdraw](./withdraw.md)**: Claim locked RAZOR tokens + +**Important Timing:** +- After unstaking at epoch `T`, you can initiate withdraw after epoch `T + 300` +- You must initiate withdraw before epoch `T + 450` (300 + 150 window) +- If you miss this window, you must call [Reset Lock](./reset-lock.md) with a penalty +- After initiating withdraw at epoch `T2`, you can withdraw after epoch `T2 + 300` + +### State Requirements {#state-requirements} + +**Why can't I call during Propose or Dispute?** +- During Propose and Dispute states, validators are actively participating in the consensus process +- Inactivity penalties are calculated during these states +- The initiate withdraw function calls `giveInactivityPenalties` which requires the state to be Commit +- This ensures all pending penalties are applied before withdrawal + +**How to check current state:** +- Use Razorscan's state indicator on the homepage +- Query `getState` function on the StakeManager contract +- States cycle through: Commit → Propose → Dispute → Commit (approximately every few minutes) + +### Lock Periods {#lock-periods-initiate} + +Current network parameters (verify on [Razorscan Governance](https://razorscan.io/governance/values)): +- **unstakeLockPeriod**: 300 epochs (time after unstake before you can initiate withdraw) +- **withdrawInitiationPeriod**: 150 epochs (window to call initiate withdraw) +- **withdrawLockPeriod**: 300 epochs (time after initiate withdraw before you can withdraw) + +### Related Operations {#related-operations-initiate} + +**Before this operation:** +- [Unstake](./unstake.md) - Must be completed first + +**After this operation:** +- Wait for withdrawLockPeriod to pass +- [Withdraw](./withdraw.md) - Claim your RAZOR tokens + +**If you miss the window:** +- [Reset Lock](./reset-lock.md) - Extend the unstake lock (incurs penalty) diff --git a/docs/reset-lock.md b/docs/reset-lock.md index a7d2ee6..d8ac06b 100644 --- a/docs/reset-lock.md +++ b/docs/reset-lock.md @@ -10,6 +10,8 @@ title: Reset Lock **Note**: _Penalty will be charged to the user while reseting unstake lock, this penalty is proportional to the users funds being unstaked_. +## Using Razorscan (Recommended for beginners) {#reset-lock-razorscan} + ### Step 1 {#step-1} Visit @@ -38,3 +40,197 @@ Click on Reset Lock in staker action dropdown and confirm the transaction. Now t **Note**: _The option for "Reset lock" in action dropdown will be only enabled if it's required._ ![Screenshot](/img/18.png) + +## Using SKALE Block Explorer (Alternative method) {#reset-lock-block-explorer} + +This method allows you to reset your unstake lock directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is required when you miss the withdrawal initiation window after unstaking. + +**Warning**: This operation incurs a penalty proportional to your unstaked funds. Only use this if you missed the `withdrawInitiationPeriod` window. + +### Prerequisites {#block-explorer-prerequisites-reset} + +Before resetting your lock via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **Completed unstaking** - You must have called [unstake](./unstake.md) previously +5. **Missed withdrawal window** - The `withdrawInitiationPeriod` has passed +6. **No existing withdraw lock** - You must not have an active withdraw lock + +### Contract Addresses {#contract-addresses-reset} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) + +### Step-by-Step Instructions {#block-explorer-steps-reset} + +#### Step 1: Verify You Need to Reset Lock {#verify-need-reset} + +Before calling reset lock, verify you actually need it: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `locks` function +4. Enter your parameters: + - **address**: Your wallet address + - **tokenAddress**: The sRZR token address for your staker + - **lockType**: `0` (for Unstake lock) +5. Click "Query" and check the result: + - `amount`: Should be greater than 0 + - `unlockAfter`: If this is more than `withdrawInitiationPeriod` epochs in the past, you need to reset + +**When to use Reset Lock:** +- You unstaked at epoch `T` +- Current epoch is greater than `T + 450` (unstakeLockPeriod + withdrawInitiationPeriod) +- You have not yet called initiate withdraw + +#### Step 2: Understand the Penalty {#understand-penalty} + +**Important**: Reset lock incurs a penalty! + +- Penalty is calculated as: `penalty = (locked sRZR × resetUnstakeLockPenalty) / BASE_DENOMINATOR` +- The penalty amount is burned (permanently removed) +- Your remaining locked amount will be reduced by the penalty +- Check current `resetUnstakeLockPenalty` parameter on [Razorscan Governance](https://razorscan.io/governance/values) + +**Example:** +- If you have 1000 sRZR locked and penalty is 1% (100/10000) +- Penalty = 1000 × 100 / 10000 = 10 sRZR +- Remaining locked = 990 sRZR + +#### Step 3: Find Your Staker ID {#find-staker-id-reset} + +You need the Staker ID for your staker: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `getStakerId` function +4. Enter your wallet address +5. Click "Query" - the result is your Staker ID + +Alternatively, you can find your Staker ID on [Razorscan](https://razorscan.io/staking). + +#### Step 4: Navigate to StakeManager Contract {#navigate-stakemanager-reset} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Click "Connect Wallet" and approve the Metamask connection +3. Verify your wallet is connected and you're on the correct network (Europa Defi Hub) + +#### Step 5: Execute Reset Unstake Lock Function {#execute-reset-lock} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`resetUnstakeLock`** function +3. Fill in the parameters: + - **stakerId (uint32)**: Enter your Staker ID from Step 3 (e.g., `42`) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. **Important**: Review the penalty that will be charged +7. Click "Confirm" in Metamask + +**Important Notes:** +- This function only requires the Staker ID parameter +- A penalty will be automatically calculated and deducted +- The penalty amount (in sRZR) is burned +- Your unstake lock will be extended by `unstakeLockPeriod` (300 epochs) from the current epoch +- After reset, you can call [Initiate Withdraw](./initiate-withdraw.md) in the new window + +#### Step 6: Verify Transaction {#verify-transaction-reset} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your reset by: + - Checking the transaction logs for a `ResetUnstakeLock` event + - Querying the `locks` function to see your updated unstake lock with new `unlockAfter` epoch + - Visiting your wallet on [Razorscan](https://razorscan.io/) to see your updated lock status + +#### Step 7: Next Steps After Reset {#next-steps-reset} + +After successfully resetting your lock: + +1. **Wait for the new unstakeLockPeriod** (300 epochs from current epoch) to pass +2. **Call [Initiate Withdraw](./initiate-withdraw.md)** within the new `withdrawInitiationPeriod` window +3. **Don't miss the window again** - Set a reminder or calendar alert +4. Track your lock status on [Razorscan](https://razorscan.io/) + +### Common Issues and Troubleshooting {#troubleshooting-reset} + +**Transaction fails with "Unstake Lock doesnt exist"** +- You don't have an active unstake lock +- Verify you've called [unstake](./unstake.md) first +- Check your lock status using Step 1 + +**Transaction fails with "Withdraw Lock exists"** +- You have an active withdraw lock +- You cannot reset if you've already called initiate withdraw +- Complete the [Withdraw](./withdraw.md) process first + +**Transaction fails with "staker doesnt exist"** +- Invalid Staker ID +- Double-check your Staker ID is correct + +**Don't see resetUnstakeLock function in Write Contract tab** +- Scroll down further in the list +- Ensure you're on the correct StakeManager contract +- Try refreshing the page + +**Penalty seems too high** +- The penalty is proportional to your locked amount +- Check the current `resetUnstakeLockPenalty` parameter on [Razorscan Governance](https://razorscan.io/governance/values) +- This is by design to discourage missing the withdrawal window + +### Understanding the Reset Lock Mechanism {#understanding-reset-lock} + +**Why does reset lock exist?** +- When you unstake, you have a limited window to initiate withdrawal +- If you miss this window, your lock expires but your funds remain locked +- Reset lock allows you to restart the process with a penalty + +**Why is there a penalty?** +- To incentivize users to follow the withdrawal process correctly +- To compensate the network for the locked state of funds +- The penalty discourages repeated front-running attempts + +**How to avoid needing reset lock:** +- Set calendar reminders for your withdrawal windows +- Use [Razorscan](https://razorscan.io/) to track your lock status +- Plan ahead and don't miss the `withdrawInitiationPeriod` window + +### Timeline After Reset {#timeline-after-reset} + +If you reset lock at epoch `T`: +1. **Epoch T**: Reset lock called, penalty deducted +2. **Epoch T+300**: Can call [Initiate Withdraw](./initiate-withdraw.md) +3. **Epoch T+450**: Must call initiate withdraw before this or need to reset again +4. **Epoch T2** (when initiate withdraw called): Initiate withdraw executed +5. **Epoch T2+300**: Can call [Withdraw](./withdraw.md) + +### Lock Periods {#lock-periods-reset} + +Current network parameters (verify on [Razorscan Governance](https://razorscan.io/governance/values)): +- **unstakeLockPeriod**: 300 epochs (new lock period after reset) +- **withdrawInitiationPeriod**: 150 epochs (window to call initiate withdraw) +- **resetUnstakeLockPenalty**: Check governance for current value (e.g., 100/10000 = 1%) + +### Related Operations {#related-operations-reset} + +**Before this operation:** +- [Unstake](./unstake.md) - Must have been completed and window missed + +**After this operation:** +- Wait for new unstakeLockPeriod to pass +- [Initiate Withdraw](./initiate-withdraw.md) - Don't miss the window this time! +- [Withdraw](./withdraw.md) - Final step to claim RAZOR + +**To avoid this operation:** +- Track your lock status carefully +- Set reminders for withdrawal windows +- Use Razorscan to monitor epochs and deadlines diff --git a/docs/stake.md b/docs/stake.md index bb185a8..cbed5ea 100644 --- a/docs/stake.md +++ b/docs/stake.md @@ -297,4 +297,192 @@ To update the razor-go node version docker exec -it razor-go razor vote --address --logFile ``` +## Using SKALE Block Explorer (Alternative method) {#staking-block-explorer} + +This method allows you to stake directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is an alternative to running the Oracle Node CLI and is recommended for advanced users who are comfortable with direct contract interaction. + +**Note**: This method only covers the staking transaction itself. To run as a validator and participate in voting, you still need to run the Oracle Node software as described in the sections above. + +### Prerequisites {#block-explorer-prerequisites} + +Before staking via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **RAZOR tokens** on Europa Defi Hub (bridge from Ethereum via [SKALE Portal](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20)) +4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +5. **Minimum 100,000 RAZOR** tokens (minSafeRazor requirement for new stakers) + +### Contract Addresses {#contract-addresses-stake} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) +- BlockManager: [`0xEa74913E6Ed2dce4c89c89F5A328b507AfD86c0e`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xEa74913E6Ed2dce4c89c89F5A328b507AfD86c0e) +- RAZOR Token: [`0xCA46B70cA3c510Ce9D0c43D25817032e2F5354c0`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xCA46B70cA3c510Ce9D0c43D25817032e2F5354c0) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) +- BlockManager: [`0x3FD90d39d6f6f9EB39E5B0cf733e0aD02241f345`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0x3FD90d39d6f6f9EB39E5B0cf733e0aD02241f345) +- RAZOR Token: [`0x99Be5a5749bA2bccfC4Bb6584cA0E405A16586C4`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0x99Be5a5749bA2bccfC4Bb6584cA0E405A16586C4) + +### Step-by-Step Instructions {#block-explorer-steps-stake} + +#### Step 1: Calculate Current Epoch {#calculate-current-epoch} + +The stake function requires the current epoch number to prevent replay attacks. The current epoch must be calculated manually using the formula: `block.timestamp / EPOCH_LENGTH (rounded down)` + +**Method 1: Using Block Explorer (Recommended)** + +1. Visit the **BlockManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xEa74913E6Ed2dce4c89c89F5A328b507AfD86c0e + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0x3FD90d39d6f6f9EB39E5B0cf733e0aD02241f345 + +2. Navigate to the **"Read Contract"** tab + +3. Get the **EPOCH_LENGTH** constant: + - Find the **`EPOCH_LENGTH`** function + - Click "Query" - note this value (e.g., `300` seconds) + +4. Get the current **block timestamp**: + - Look at the top of the page for the latest block number + - Click on the block number to view block details + - Note the "Timestamp" value + +5. Calculate the current epoch: + ``` + Current Epoch = block.timestamp / EPOCH_LENGTH (rounded down) + ``` + + **Example:** + - If block timestamp = 1234567890 + - And EPOCH_LENGTH = 450 + - Then current epoch = 1234567890 / 450 = 2743484 (after rounding down) + +**Method 2: Using Razorscan (Easier)** + +Alternatively, you can see the current epoch displayed on [Razorscan](https://razorscan.io/) homepage. + +**Important**: +- Epochs change every EPOCH_LENGTH seconds +- Calculate the epoch right before staking to avoid transaction failures +- If your transaction fails with an epoch mismatch, recalculate and try again immediately + +#### Step 2: Approve RAZOR Tokens {#approve-tokens-stake} + +Before staking, you must approve the StakeManager contract to spend your RAZOR tokens: + +1. Visit the **RAZOR Token contract** on the block explorer (use links above) +2. Click "Connect Wallet" and approve the Metamask connection +3. Verify your wallet is connected and you're on the correct network (Europa Defi Hub) +4. Navigate to the **"Write Contract"** tab +5. Find the **`approve`** function +6. Fill in the parameters: + - **spender (address)**: Enter the StakeManager contract address: + - Mainnet: `0xd492408e4901CF658c7874285984F6D5Db648D1E` + - Testnet: `0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012` + - **amount (uint256)**: Enter the amount in wei (e.g., for 100,000 RAZOR, enter `100000000000000000000000`) +7. Click "Write" and confirm the transaction in Metamask +8. Wait for the transaction to be confirmed + +**Note**: _1 RAZOR = 10^18 wei. For the minimum stake of 100,000 RAZOR = 100000000000000000000000 wei_ + +#### Step 3: Navigate to StakeManager Contract {#navigate-stakemanager-stake} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Ensure your wallet is still connected (if not, click "Connect Wallet" again) + +#### Step 4: Execute Stake Function {#execute-stake} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`stake`** function +3. Fill in the parameters: + - **epoch (uint32)**: Enter the current epoch number from Step 1 (e.g., `42`) + - **amount (uint256)**: Enter the stake amount in wei (e.g., for 100,000 RAZOR, enter `100000000000000000000000`) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. Click "Confirm" in Metamask + +**Important Notes:** +- **First-time stakers**: Minimum stake is 100,000 RAZOR (100000000000000000000000 wei) +- **Adding stake**: If you're already a staker, you can add any amount +- The epoch must match the current epoch, otherwise the transaction will fail +- Ensure you've completed the token approval in Step 2 + +#### Step 5: Verify Transaction {#verify-transaction-stake} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your stake by: + - Checking the transaction logs for a `Staked` event + - Visiting your wallet on [Razorscan](https://razorscan.io/) to see your staker information + - Querying `getStakerId` with your address on the StakeManager contract + +#### Step 6: Set Up Oracle Node (Required for validators) {#setup-oracle-node} + +**Important**: Staking tokens is only the first step. To participate as a validator and earn rewards, you must: + +1. Run the Oracle Node software (see [Using Docker](#using-docker) section above) +2. Start voting with the `vote` command +3. Keep your node online and operational + +Without running the Oracle Node, you'll only be staking tokens but won't be participating in the network or earning rewards. + +### Common Issues and Troubleshooting {#troubleshooting-stake} + +**Transaction fails with "less than minimum safe Razor"** +- Your stake amount is below the 100,000 RAZOR minimum requirement for new stakers +- Increase your stake amount to at least 100,000 RAZOR + +**Transaction fails with "ERC20: insufficient allowance"** +- You didn't complete Step 2 (token approval), or approved an insufficient amount +- Go back to Step 2 and approve the correct amount + +**Transaction fails with "Staker is slashed"** +- Your staker account has been slashed for malicious behavior +- You cannot add stake to a slashed account + +**Transaction fails due to epoch mismatch** +- The epoch you provided doesn't match the current epoch +- Epochs change approximately every X hours +- Go back to Step 1, get the current epoch, and try again immediately + +**Transaction fails with "Nonpositive Amount"** +- The amount parameter is 0 or invalid +- Check your wei conversion is correct + +### Wei Conversion Helper {#wei-conversion-stake} + +To convert RAZOR amounts to wei for the smart contract: + +- 100,000 RAZOR (minimum) = `100000000000000000000000` wei +- 200,000 RAZOR = `200000000000000000000000` wei +- 500,000 RAZOR = `500000000000000000000000` wei +- 1,000,000 RAZOR = `1000000000000000000000000` wei + +Formula: **RAZOR amount × 1,000,000,000,000,000,000** + +You can also use online converters or tools like `web3.utils.toWei()` in JavaScript. + +### Setting Delegation Acceptance {#setting-delegation} + +After staking, if you want to accept delegations from other users: + +1. First, set your commission rate using the [`updateCommission`](./commands/staker/update-commission) command +2. Then enable delegation acceptance using the [`setDelegationAcceptance`](./commands/staker/set-delegation) command + +These operations are currently only available via the Oracle Node CLI, not through the block explorer. + +### Related Operations {#related-operations-stake} + +After staking, you may want to: +- [Set Delegation](./commands/staker/set-delegation) - Enable accepting delegations +- [Update Commission](./commands/staker/update-commission) - Set commission rate +- [Unstake](./unstake.md) - Begin the unstaking process +- [Claim Commission](./commands/staker/claim-commission) - Claim earned commissions + --- diff --git a/docs/unstake.md b/docs/unstake.md index 4c3b46e..fc102e2 100644 --- a/docs/unstake.md +++ b/docs/unstake.md @@ -19,6 +19,8 @@ Unstaking and withdrawing funds from Razor Network is a 3 step process. **Note**: _Please check the current network parameters [here](https://razorscan.io/governance/values).You can get the stakers sRAZOR address by clicking on the `+` icon on that stakers delegate/unstake modal._ +## Using Razorscan (Recommended for beginners) {#unstake-razorscan} + ### Step 1 {#step-1} Visit @@ -56,3 +58,188 @@ Once both transactions are successful, [Initiate Withdraw](/docs/initiate-withdr ![Screenshot](/img/unstake/unstake_step4.png) **Note**: _To get the exact values of the lock periods check Governance [here](https://razorscan.io/governance/values)_. + +## Using SKALE Block Explorer (Alternative method) {#unstake-block-explorer} + +This method allows you to unstake directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is recommended for advanced users who are comfortable with direct contract interaction. + +### Prerequisites {#block-explorer-prerequisites-unstake} + +Before unstaking via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **sRZR tokens** (staked RAZOR tokens) in your wallet +4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +5. **Staker ID** for the staker you want to unstake from +6. **No existing locks** - you cannot have an existing unstake or withdraw lock + +### Contract Addresses {#contract-addresses-unstake} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) + +### Step-by-Step Instructions {#block-explorer-steps-unstake} + +#### Step 1: Find Your Staker ID {#find-staker-id-unstake} + +You need to know the Staker ID for the validator you're unstaking from: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `getStakerId` function +4. Enter your wallet address (if you're a staker) or the validator's address (if you delegated) +5. Click "Query" - the result is the Staker ID + +Alternatively, you can find your Staker ID on [Razorscan](https://razorscan.io/staking). + +#### Step 2: Check Your sRZR Balance {#check-srzr-balance} + +You need to know how much sRZR (staked RAZOR) you have: + +**Method 1: Using Razorscan** +1. Visit [Razorscan](https://razorscan.io/) +2. Connect your wallet +3. View your staking information to see your sRZR balance + +**Method 2: Using Block Explorer** +1. Find the sRZR token contract address for your staker (each staker has a unique sRZR token) +2. Query the `balanceOf` function with your address +3. The result is your sRZR balance in wei + +#### Step 3: Approve sRZR Transfer {#approve-srzr-transfer} + +Before unstaking, you must approve the StakeManager contract to transfer your sRZR tokens: + +1. Visit the **sRZR Token contract** on the block explorer + - You can find the sRZR token address by querying the `getStaker` function with your Staker ID + - Look for the `tokenAddress` field in the result + +2. Click "Connect Wallet" and approve the Metamask connection +3. Navigate to the **"Write Contract"** tab +4. Find the **`approve`** function +5. Fill in the parameters: + - **spender (address)**: Enter the StakeManager contract address: + - Mainnet: `0xd492408e4901CF658c7874285984F6D5Db648D1E` + - Testnet: `0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012` + - **amount (uint256)**: Enter the sRZR amount in wei that you want to unstake +6. Click "Write" and confirm the transaction in Metamask +7. Wait for the transaction to be confirmed + +#### Step 4: Navigate to StakeManager Contract {#navigate-stakemanager-unstake} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Ensure your wallet is connected + +#### Step 5: Execute Unstake Function {#execute-unstake} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`unstake`** function +3. Fill in the parameters: + - **stakerId (uint32)**: Enter the Staker ID from Step 1 (e.g., `42`) + - **sAmount (uint256)**: Enter the amount of sRZR to unstake in wei (e.g., `1000000000000000000000` for 1000 sRZR) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. Click "Confirm" in Metamask + +**Important Notes:** +- The amount is in **sRZR** (staked RAZOR), not RAZOR +- You must not have an existing unstake or withdraw lock +- After unstaking, your sRZR tokens will be locked for `unstakeLockPeriod` (currently 300 epochs) +- You must call [Initiate Withdraw](./initiate-withdraw.md) within the `withdrawInitiationPeriod` (150 epochs) + +#### Step 6: Verify Transaction {#verify-transaction-unstake} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your unstake by: + - Checking the transaction logs for an `Unstaked` event + - Visiting your wallet on [Razorscan](https://razorscan.io/) to see your lock status + +#### Step 7: Next Steps {#next-steps-unstake} + +After successfully unstaking: + +1. **Wait for unstakeLockPeriod** (currently 300 epochs) to pass +2. **Call [Initiate Withdraw](./initiate-withdraw.md)** within the withdrawal initiation window +3. If you miss the window, you'll need to call [Reset Lock](./reset-lock.md) (which incurs a penalty) + +### Common Issues and Troubleshooting {#troubleshooting-unstake} + +**Transaction fails with "Existing Withdraw Lock"** +- You already have a pending withdraw lock +- Complete the withdrawal process first before unstaking again + +**Transaction fails with "Existing Unstake Lock"** +- You already have a pending unstake lock +- Complete the initiate withdraw and withdrawal process, or use [Reset Lock](./reset-lock.md) + +**Transaction fails with "Invalid Amount"** +- You don't have enough sRZR tokens +- Check your sRZR balance using Step 2 + +**Transaction fails with "Non-Positive Amount"** +- The sAmount parameter is 0 or invalid +- Enter a value greater than 0 + +**Transaction fails with "Nonpositive stake"** +- The staker has no stake +- Verify you're using the correct Staker ID + +**Transaction fails with "staker.id = 0"** +- Invalid Staker ID +- Double-check the Staker ID is correct + +**Transaction fails with "ERC20: insufficient allowance"** +- You didn't complete Step 3 (sRZR approval), or approved an insufficient amount +- Go back to Step 3 and approve the correct amount + +### Understanding sRZR Tokens {#understanding-srzr} + +**What is sRZR?** +- sRZR (staked RAZOR) is an ERC20 token that represents your stake in a specific validator +- Each validator has their own unique sRZR token contract +- The ratio of sRZR to RAZOR changes based on rewards and penalties +- When you stake/delegate, you receive sRZR tokens +- When you unstake, you burn sRZR tokens to begin the withdrawal process + +**sRZR to RAZOR Conversion:** +- The conversion rate is: `RAZOR amount = (sRZR amount × total staker stake) / total sRZR supply` +- This rate improves over time as rewards are earned +- You can view this ratio on Razorscan + +### Wei Conversion Helper {#wei-conversion-unstake} + +To convert sRZR amounts to wei for the smart contract: + +- 100 sRZR = `100000000000000000000` wei +- 1000 sRZR = `1000000000000000000000` wei +- 5000 sRZR = `5000000000000000000000` wei + +Formula: **sRZR amount × 1,000,000,000,000,000,000** + +### Lock Periods {#lock-periods} + +Current network parameters (verify on [Razorscan Governance](https://razorscan.io/governance/values)): +- **unstakeLockPeriod**: 300 epochs (time before you can call initiate withdraw) +- **withdrawInitiationPeriod**: 150 epochs (window to call initiate withdraw) +- **withdrawLockPeriod**: 300 epochs (time after initiate withdraw before you can withdraw) + +### Related Operations {#related-operations-unstake} + +After unstaking, you must complete the withdrawal process: +1. Wait for unstakeLockPeriod to pass +2. [Initiate Withdraw](./initiate-withdraw.md) - Burn sRZR and lock RAZOR +3. Wait for withdrawLockPeriod to pass +4. [Withdraw](./withdraw.md) - Claim your RAZOR tokens + +If you miss the withdrawal initiation window: +- [Reset Lock](./reset-lock.md) - Extend the unstake lock (incurs penalty) diff --git a/docs/withdraw.md b/docs/withdraw.md index 4ac5003..5874ba1 100644 --- a/docs/withdraw.md +++ b/docs/withdraw.md @@ -4,6 +4,8 @@ title: Withdraw Withdraw is only allowed after `Initiate Withdraw` is called. Withdraw will transfer locked $RAZOR tokens to the user's address. +## Using Razorscan (Recommended for beginners) {#withdraw-razorscan} + ### Step 1 {#step-1} Visit @@ -37,3 +39,165 @@ Once you have Initiated withdraw and `withdrawAfterPeriod` has passed, you can w Clicking on Withdraw will open a modal to withdraw the locked RAZOR. You can confirm the details if you would like and then click on Withdraw on the modal. Confirm the transaction, and your $RAZOR will be sent to your address. ![Screenshot](/img/withdraw/Withdraw_step5.png) + +## Using SKALE Block Explorer (Alternative method) {#withdraw-block-explorer} + +This method allows you to withdraw (unlock) your RAZOR tokens directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is the final step in the withdrawal process and will transfer your locked RAZOR tokens back to your wallet. + +### Prerequisites {#block-explorer-prerequisites-withdraw} + +Before withdrawing via the block explorer, ensure you have: + +1. **Metamask wallet** installed and configured +2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) +3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **Completed initiate withdraw** - You must have called [Initiate Withdraw](./initiate-withdraw.md) previously +5. **Withdraw lock expired** - The `withdrawLockPeriod` must have passed + +### Contract Addresses {#contract-addresses-withdraw} + +**Mainnet (Europa Defi Hub):** +- StakeManager: [`0xd492408e4901CF658c7874285984F6D5Db648D1E`](https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E) + +**Testnet (Europa Defi Hub Testnet):** +- StakeManager: [`0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012`](https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012) + +### Step-by-Step Instructions {#block-explorer-steps-withdraw} + +#### Step 1: Verify Withdraw Lock Status {#verify-withdraw-lock} + +Before calling withdraw, verify your withdraw lock is ready: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `locks` function +4. Enter your parameters: + - **address**: Your wallet address + - **tokenAddress**: The sRZR token address for your staker + - **lockType**: `1` (for Withdraw lock) +5. Click "Query" and check the result: + - `amount`: Should be greater than 0 (this is the RAZOR amount you'll receive) + - `unlockAfter`: Should be less than or equal to current epoch + +If `unlockAfter` is still greater than the current epoch, wait until the lock period expires. + +#### Step 2: Find Your Staker ID {#find-staker-id-withdraw} + +You need the Staker ID for your staker: + +1. Visit the StakeManager contract on the block explorer (links above) +2. Go to the "Read Contract" tab +3. Find the `getStakerId` function +4. Enter your wallet address +5. Click "Query" - the result is your Staker ID + +Alternatively, you can find your Staker ID on [Razorscan](https://razorscan.io/staking). + +#### Step 3: Navigate to StakeManager Contract {#navigate-stakemanager-withdraw} + +1. Visit the **StakeManager contract** on the block explorer: + - **Mainnet**: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/0xd492408e4901CF658c7874285984F6D5Db648D1E + - **Testnet**: https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/address/0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 + +2. Click "Connect Wallet" and approve the Metamask connection +3. Verify your wallet is connected and you're on the correct network (Europa Defi Hub) + +#### Step 4: Execute Unlock Withdraw Function {#execute-unlock-withdraw} + +1. Navigate to the **"Write Contract"** tab +2. Scroll down and find the **`unlockWithdraw`** function +3. Fill in the parameters: + - **stakerId (uint32)**: Enter your Staker ID from Step 2 (e.g., `42`) + +4. Click "Write" to submit the transaction +5. Review the transaction details in the Metamask popup +6. Click "Confirm" in Metamask + +**Important Notes:** +- This function only requires the Staker ID parameter +- It will transfer your locked RAZOR tokens to your wallet +- This resets both your unstake and withdraw locks +- After withdrawal, you can stake or delegate again if you wish + +#### Step 5: Verify Transaction {#verify-transaction-withdraw} + +1. After confirming in Metamask, wait for the transaction to be processed +2. Once confirmed, you'll see a success message in the block explorer +3. Click on the transaction hash to view transaction details +4. You can verify your withdrawal by: + - Checking the transaction logs for a `Withdrew` event + - Checking your RAZOR token balance in Metamask + - Visiting your wallet on [Razorscan](https://razorscan.io/) to verify locks are cleared + +#### Step 6: Verify Your RAZOR Balance {#verify-razor-balance} + +Your RAZOR tokens have been transferred back to your wallet: + +1. Open Metamask and ensure you're on Europa Defi Hub network +2. Check your RAZOR token balance +3. You can now use these tokens as you wish (stake again, transfer, etc.) + +### Common Issues and Troubleshooting {#troubleshooting-withdraw} + +**Transaction fails with "Did not initiate withdraw"** +- You don't have an active withdraw lock +- You must call [Initiate Withdraw](./initiate-withdraw.md) first + +**Transaction fails with "Withdraw epoch not reached"** +- The withdraw lock period hasn't expired yet +- Wait until the `unlockAfter` epoch has passed +- Check your lock status using the method in Step 1 + +**Transaction fails with "staker doesnt exist"** +- Invalid Staker ID +- Double-check your Staker ID is correct + +**No RAZOR received after successful transaction** +- Check if you're looking at the correct wallet address +- Verify the transaction was actually successful in the block explorer +- Check transaction logs for the `Withdrew` event to see the amount transferred + +### Understanding the Complete Withdrawal Process {#understanding-complete-withdrawal} + +Congratulations! You've completed the full withdrawal process: + +1. **[Unstake](./unstake.md)**: Locked sRZR tokens for 300 epochs ✓ +2. **[Initiate Withdraw](./initiate-withdraw.md)**: Burned sRZR and locked RAZOR for 300 epochs ✓ +3. **Withdraw** (this step): Claimed locked RAZOR tokens ✓ + +**What happens after withdrawal:** +- All your locks (unstake and withdraw) are reset +- You can stake or delegate again immediately if you wish +- Your RAZOR tokens are fully liquid in your wallet + +### Lock Periods Summary {#lock-periods-withdraw} + +For reference, here's the complete timeline: +- **Epoch T**: Unstake called +- **Epoch T+300**: Can call Initiate Withdraw (must do before T+450) +- **Epoch T2**: Initiate Withdraw called +- **Epoch T2+300**: Can call Withdraw (anytime after this) + +Current network parameters (verify on [Razorscan Governance](https://razorscan.io/governance/values)): +- **unstakeLockPeriod**: 300 epochs +- **withdrawInitiationPeriod**: 150 epochs (window to call initiate withdraw) +- **withdrawLockPeriod**: 300 epochs + +### Next Steps After Withdrawal {#next-steps-withdraw} + +Now that you've successfully withdrawn your RAZOR tokens, you can: + +1. **Stake again** - Become a validator by calling [Stake](./stake.md) +2. **Delegate again** - Delegate to a validator by calling [Delegate](./delegate.md) +3. **Transfer tokens** - Send RAZOR to another address +4. **Bridge tokens** - Move RAZOR to Ethereum via [SKALE Portal Bridge](https://portal.skale.space/bridge) + +### Related Operations {#related-operations-withdraw} + +**Before this operation:** +- [Unstake](./unstake.md) - Step 1 of the withdrawal process +- [Initiate Withdraw](./initiate-withdraw.md) - Step 2 of the withdrawal process + +**After this operation (optional):** +- [Stake](./stake.md) - Stake your RAZOR tokens again +- [Delegate](./delegate.md) - Delegate to a validator From 740379ffd329e0ff8b75e4477db8b48a0a9d6b06 Mon Sep 17 00:00:00 2001 From: rajkharvar Date: Sun, 16 Nov 2025 14:22:48 +0530 Subject: [PATCH 2/2] chore: update faucet links --- docs/delegate.md | 4 ++-- docs/initiate-withdraw.md | 2 +- docs/razor-v2/mainnet.md | 2 +- docs/razor-v2/testnet.md | 2 +- docs/reset-lock.md | 2 +- docs/stake.md | 5 ++--- docs/unstake.md | 2 +- docs/withdraw.md | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/delegate.md b/docs/delegate.md index e3421f7..33dc14f 100644 --- a/docs/delegate.md +++ b/docs/delegate.md @@ -4,7 +4,7 @@ title: Delegate Razor network is a proof of stake network. In order to participate in the network as a delegator, you will need to "Delegate" your RAZORs. RAZOR is (`ERC20` token standard) the native token in Razor Network. -In order to delegate, you will also need some RAZOR tokens on Europa Defi Hub. You can bridge RAZOR tokens from Ethereum to Europa Defi Hub using [SKALE Portal Bridge](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20). More info regarding RAZOR Token bridge can be found [here](/docs/token-bridge/europa-defi-hub#ethereum-to-europa-defi-hub). To pay transaction fees on Europa Defi Hub you will require sFUEL to pay for gas, you can get sFUEL from [Faucet](https://www.sfuelstation.com/). +In order to delegate, you will also need some RAZOR tokens on Europa Defi Hub. You can bridge RAZOR tokens from Ethereum to Europa Defi Hub using [SKALE Portal Bridge](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20). More info regarding RAZOR Token bridge can be found [here](/docs/token-bridge/europa-defi-hub#ethereum-to-europa-defi-hub). To pay transaction fees on Europa Defi Hub you will require sFUEL to pay for gas. Get sFUEL from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting your wallet. @@ -72,7 +72,7 @@ Before delegating via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) 3. **RAZOR tokens** on Europa Defi Hub (bridge from Ethereum via [SKALE Portal](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20)) -4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 5. **Staker ID** of the validator you want to delegate to ### Contract Addresses {#contract-addresses} diff --git a/docs/initiate-withdraw.md b/docs/initiate-withdraw.md index 90a7863..aed0208 100644 --- a/docs/initiate-withdraw.md +++ b/docs/initiate-withdraw.md @@ -52,7 +52,7 @@ Before initiating withdrawal via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) -3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +3. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 4. **Completed unstaking** - You must have called [unstake](./unstake.md) previously 5. **Unstake lock expired** - The `unstakeLockPeriod` must have passed 6. **Within initiation window** - You must be within the `withdrawInitiationPeriod` diff --git a/docs/razor-v2/mainnet.md b/docs/razor-v2/mainnet.md index 4eedfc6..bcd293f 100644 --- a/docs/razor-v2/mainnet.md +++ b/docs/razor-v2/mainnet.md @@ -7,7 +7,7 @@ Razor Network is currently live on Mainnet. Details regarding mainnet is mention | Chain name | Europa Defi Hub | | ChainID | 2046399126 | | Chain currency | sFUEL | -| Faucet | https://www.sfuelstation.com/ | +| Faucet | https://portal.skale.space/chains/europa | | RPC Endpoint | https://mainnet.skalenodes.com/v1/elated-tan-skat | | Chain Explorer | https://elated-tan-skat.explorer.mainnet.skalenodes.com/ | | Token type | ERC-20 | diff --git a/docs/razor-v2/testnet.md b/docs/razor-v2/testnet.md index f5b6d39..98c4224 100644 --- a/docs/razor-v2/testnet.md +++ b/docs/razor-v2/testnet.md @@ -7,7 +7,7 @@ Razor Network details on Testnet are mentioned below: | Chain name | Europa Defi Hub Testnet | | ChainID | 1444673419 | | Chain currency | sFUEL | -| Faucet | https://www.sfuelstation.com/ | +| Faucet | https://testnet.portal.skale.space/chains/europa | | RPC Endpoint | https://testnet.skalenodes.com/v1/juicy-low-small-testnet | | Chain Explorer | https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/ | | Token type | ERC-20 | diff --git a/docs/reset-lock.md b/docs/reset-lock.md index d8ac06b..19a0d0a 100644 --- a/docs/reset-lock.md +++ b/docs/reset-lock.md @@ -53,7 +53,7 @@ Before resetting your lock via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) -3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +3. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 4. **Completed unstaking** - You must have called [unstake](./unstake.md) previously 5. **Missed withdrawal window** - The `withdrawInitiationPeriod` has passed 6. **No existing withdraw lock** - You must not have an active withdraw lock diff --git a/docs/stake.md b/docs/stake.md index cbed5ea..7154feb 100644 --- a/docs/stake.md +++ b/docs/stake.md @@ -5,8 +5,7 @@ Razor network is a proof of stake network. In order to participate in the networ ## Get tokens {#get-tokens} You will need some sFUEL to pay for transaction fees. -You can get sFUEL from here: -https://www.sfuelstation.com/ +You can get sFUEL from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting your wallet. In order to get started, you will also need some RAZOR tokens on Europa chain. You can bridge RAZOR tokens from Ethereum to Europa Defi Hub using [Skale Portal](https://portal.skale.space/bridge). More info regarding RAZOR Token bridge can be found [here](/docs/token-bridge/europa-defi-hub) @@ -310,7 +309,7 @@ Before staking via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) 3. **RAZOR tokens** on Europa Defi Hub (bridge from Ethereum via [SKALE Portal](https://portal.skale.space/bridge?from=mainnet&to=elated-tan-skat&token=razor&type=erc20)) -4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 5. **Minimum 100,000 RAZOR** tokens (minSafeRazor requirement for new stakers) ### Contract Addresses {#contract-addresses-stake} diff --git a/docs/unstake.md b/docs/unstake.md index fc102e2..b248a21 100644 --- a/docs/unstake.md +++ b/docs/unstake.md @@ -70,7 +70,7 @@ Before unstaking via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) 3. **sRZR tokens** (staked RAZOR tokens) in your wallet -4. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +4. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 5. **Staker ID** for the staker you want to unstake from 6. **No existing locks** - you cannot have an existing unstake or withdraw lock diff --git a/docs/withdraw.md b/docs/withdraw.md index 5874ba1..8c99bb6 100644 --- a/docs/withdraw.md +++ b/docs/withdraw.md @@ -50,7 +50,7 @@ Before withdrawing via the block explorer, ensure you have: 1. **Metamask wallet** installed and configured 2. **Europa Defi Hub network** added to Metamask (see [network details](./razor-v2/mainnet.md)) -3. **sFUEL tokens** for gas fees (get from [faucet](https://www.sfuelstation.com/)) +3. **sFUEL tokens** for gas fees (get from [SKALE Portal](https://portal.skale.space/chains/europa) after connecting wallet) 4. **Completed initiate withdraw** - You must have called [Initiate Withdraw](./initiate-withdraw.md) previously 5. **Withdraw lock expired** - The `withdrawLockPeriod` must have passed