gnolang / independence-day

Gno.land airdrop scripts.
https://gno.land/
6 stars 7 forks source link

TODO: manage Escrow accounts #14

Closed moul closed 1 year ago

moul commented 2 years ago

I find another edge case to manage: escrow accounts, i.e.

https://www.mintscan.io/cosmos/account/cosmos1x54ltnyg88k0ejmk8ytwrhd3ltm84xehrnlslf (looks like to be for osmosis).

~5M atom on may 20th. ~9M atom on the airdrop file.


cat snapshot_consolidated_10562840.json | jq '.[] | select(.address=="cosmos1x54ltnyg88k0ejmk8ytwrhd3ltm84xehrnlslf")'

{                            
  "address": "cosmos1x54ltnyg88k0ejmk8ytwrhd3ltm84xehrnlslf",                                                                
  "coins": [
    {
      "amount": "61010137",
      "denom": "ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66"
    },
    {
      "amount": "10000000",   
      "denom": "ibc/1542F8DC70E7999691E991E1EDEB1B47E65E3A217B1649D347098EE48ACB580F"
    },
    {
      "amount": "2039990880534",
      "denom": "ibc/1BE91D67775723D3230A9A5AC54BB29B92A5A51B4B8F20BBA37DF1CFA602297C"
    },
   [........],
    {
      "amount": "9197744591079",
      "denom": "uatom"                                                                                                       
    } 
  ], 
  "vote": ""                
}              

$ gaiad q ibc-transfer escrow-address transfer channel-141 --chain-id 1 --node https://rpc.cosmos.network  

cosmos1x54ltnyg88k0ejmk8ytwrhd3ltm84xehrnlslf

I suggest that we just skip them completely.

giansalex commented 1 year ago

yes, it should definitely be omitted, evmos found this issue when it finished its airdrop.

a snippet to get the escrow address:


import (
"crypto/sha256"
"fmt"
"github.com/gnolang/gno/pkgs/bech32"

)

func GetEscrowAddress(portID, channelID string) (string, error) { contents := fmt.Sprintf("%s/%s", portID, channelID)

preImage := []byte("ics20-1")
preImage = append(preImage, 0)
preImage = append(preImage, contents...)
hash := sha256.Sum256(preImage)

return bech32.Encode("cosmos", hash[:20])

}

// GetEscrowAddress("transfer", "channel-141")