stargate-protocol / stargate

Other
281 stars 142 forks source link

Swap remote issue: transfer token to address(0) on destination chain #4

Open quan-unizen opened 2 years ago

quan-unizen commented 2 years ago

Hi SG team,

I was integrated SG router to my smart contract, in my smart contract I set address on destination chain based on layerzero chain id, then layerzero changed chain id from 1 to 101 (Ethereum for example), so if I forget to set address again to new chain id and passed 101 as param (from frontend code), that could cause transfer stable amount to address(0) on destination chain.

I think to prevent it, the Pool contract should validate _to address when transfer stable tokens, example in swapRemote function: https://github.com/stargate-protocol/stargate/blob/main/contracts/Pool.sol#L310