Skip to main content

Stake Pool

有官方的 LSD 实现:

https://github.com/solana-labs/solana-program-library/blob/f542e00a8905eaf3f55dea1c08ca4787138e1788/stake-pool/program/src/processor.rs#L3843

Stake Pool Introduction | Solana Program Library Docs

fee

在文档 fee 最佳实践的相关介绍中,说明了设置 deposit / withdraw fee 的必要性以阻止一些潜在的,可能造成窃取利润的攻击: Fees | Solana Program Library Docs

我认为这种攻击作为一个exploit是很难利用的,需要巨大的成本和不确定的风险。但是这种依赖fee的安全机制可能导致某些预言机价格的偏差。

stake account

关于质押账户的设置比较复杂。

用户使用 ix process_deposit_sol 发送sol到 pool 时,会兑换相应的 pool tokens,但是此时 stake 并没有开始。需要将 sol / activity stake account 存入 stake pool 才会开始stake。具体操作可以参考样例脚本:https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/cli/scripts/deposit.sh

create_user_stakes "$validator_list" "$sol_amount" $authority
echo "Delegating user stakes so that deposit will work"
delegate_user_stakes "$validator_list" $authority

echo "Waiting for stakes to activate, this may take awhile depending on the network!"
echo "If you are running on localnet with 32 slots per epoch, wait 12 seconds..."
sleep 12
echo "Depositing stakes into stake pool"
deposit_stakes "$stake_pool_pubkey" "$validator_list" $authority

 

Reference

  1. 一个关于 LST 流动性交换的有趣的提案:https://forum.jito.network/t/jip-9-adopt-interceptor-liquidity-defense/444 ,以及和它相关的一个使用 Sanctum 交换的 tx https://solana.fm/tx/5e85Y584teHe8PmFZcDTDgneDCuG6f6cYqesFRYjJkwi76gqoZdy2W8R1KqDy5Met3NGDkzdM667gFQsRpzRgLeA?cluster=mainnet-alpha