Skip to content

Keyur279/Everstake_HYSP_POC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HYSP Vault POC Script

End-to-end proof of concept for the Cypherock x Everstake HYSP integration. Tests deposit, instant redeem, and queue redeem flows against Ethereum mainnet using the Cypherock X1 for signing.


Setup

npm install

Run:

npx tsx index.ts

How it works

The script runs sequentially through 7 steps. At each write step (approve, deposit, redeem) it prints a serialized unsigned transaction, pauses, and waits for you to paste a signed transaction from Cypherock X1 back. Press Enter to skip any step.

Signing flow:

  1. Script prints serialized unsigned tx
  2. Paste into your HW wallet SDK (EvmApp.signTxn({ txn: "<serialized>", serializeTxn: true, ... }))
  3. Device signs it, copy the serializedTxn output
  4. Paste back into the script prompt
  5. Script broadcasts and waits for on-chain confirmation

Constants

All configurable values are at the top of index.ts:

const WALLET_ADDRESS         // your wallet public address
const USDC_ADDRESS           // USDC contract address
const REFERRER_ID            // always "SDK:cypherockwallet:prod:v1" — do not change
const DEPOSIT_AMOUNT_USDC    // amount to deposit (plain number, e.g. 6)
const REDEEM_AMOUNT_MEVUSD   // amount to redeem (plain number, e.g. 5)
const CHAIN_ID               // 1 for ETH mainnet, 8453 for Base
const RPC_URL                // public RPC — swap for paid APIs in prod

For Base mainnet

const CHAIN_ID = 8453;
const RPC_URL = "https://base.publicnode.com";
const USDC_ADDRESS = getAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");

Change SDK init in main():

await hysp.init("base");

For USDT instead of USDC

// ETH mainnet USDT
const USDT_ADDRESS = getAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7");

Pass USDT_ADDRESS wherever USDC_ADDRESS is used in deposit and redeem calls.


Steps

Step 1 — SDK init
Step 2 — Read calls (APY, price, fees, liquidity, balances)
Step 3 — Approve USDC for deposit
Step 4 — Deposit USDC to mevUSD
Step 5 — Approve mevUSD for redemption
Step 6 — Instant redeem mevUSD to USDC
Step 7 — Queue redeem (structure only, not broadcasting)

To run read calls only (no signing)

Keep steps 1 and 2 active. Comment out steps 3 to 7.

To run deposit only

Keep steps 1, 2, 3, 4. Comment out steps 5, 6, 7.

To run instant redeem only

Keep steps 1, 2, 5, 6. Comment out steps 3, 4, 7.

Note: step 5 approve can be skipped if the redemption vault already has sufficient mevUSD allowance from a previous run. Check on-chain allowance before skipping.

To run queue redeem structure only

Keep steps 1, 2, 7. Comment out steps 3, 4, 5, 6.

Note: queue redeem requires a minimum amount (confirm with Everstake) and broadcasting is disabled in step 7 by default.


Notes

  • All write methods (approve, deposit, redeem) expect plain human-readable numbers. Do not use parseUnits — the SDK handles decimal conversion internally.
  • REFERRER_ID must always be included in every deposit. This is a contractual requirement for revenue share attribution.
  • Gas price is set to 1.5x current network price to ensure timely confirmation. Adjust the multiplier in serializeTx() if needed.
  • Public RPC may be slow. Replace RPC_URL with an paid endpoint for faster responses.

Files

index.ts       — main POC script
package.json
tsconfig.json

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors