ChorusOne/solido

[Anchor] ClaimRewards + SendRewards

Closed this issue · 4 comments

Main issue: #438
Following the anchor-integration branch.

ClaimRewards

stSOL rewards should be claimed, this will sell stSOL to TerraUSD on Orca (as decided in #438). Once the rewards were sold, they have to be transferred to the Terra chain by using Wormhole.
We can restrict the function to be called only in the beginning of every epoch by anyone.

@RishiSid can update on this issue once done with the Wormhole tests.

Summary

Only 2 transactions happened from SOL -> ETH

  1. Transfer SOL tokens via wormhole
  2. Redeem SOL on Ethereum

@enriquefynn @ruuda I hope this suffices. From what I remember while building the Orca guide the reverse direction had more transactions. Wondering if that is relevant at all!

ruuda commented

It looks like the instructions on the Solana side first wrapped SOL into an SPL token (wrapped SOL). Makes sense, if Wormhole only wants to deal with SPL tokens, and not with native SOL. The meat of it appears to be the sixth instruction, calling wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb. (And also the fifth instruction, calling Approve, is likely necessary.)

The Ethereum destination address (0x29fc5aacd613410b68c9c08d4e1656e3c890e482) occurs in the instruction data of the sixth instruction.

I’m not sure what all of the input accounts are, but so far it looks like we could do an SPL token Approve followed by a call to Wormhole, and that would be sufficient.

ruuda commented

Here’s a testnet transaction from Solana to Terra sending 1,000.0 of token Ch8aNS4Bh3Y4beUTgbBNBgnzAniSj2XxiXoREho3nXy2.

I don’t appear to have any new tokens on the Terra side now though.

CC @enriquefynn

ruuda commented

I also did a transfer back from Solana to Terra of the wrapped UST:

The instruction is different this time, it’s a transfer_wrapped, not transfer_native, because UST is a wrapped token on Solana.