Skip to content

Decoding a Nested Structure - Decoding Smart Contract Data Client Side Issue #93

@SMWARREN

Description

@SMWARREN

Screen Shot 2021-11-16 at 8 02 51 PM

base64 data: AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA73eAAAAAAAFpiYAAAAAA
Hex data: 00000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003bdde000000000005a626000000000

Hex data manually "decoded":

00000001 // List with 1 Gamestate

0000000000000000 // GameState Fee 0
0000000000000000 //GameState End 0
0000000000000000 //GameState current leader
00000000 //empty list of participants
0000000000000000 // GameState PrizePool 0
0000000000000000 //GameState Dethrone count

00000000003bdde0 //Game Price Pool
00000000005a6260 //Game Fund Pool
00000000 //empty list of tickets

For now i just have a list of u64 that a can query using a storage mapper.

Contract Address on Testnet: erd1qqqqqqqqqqqqqpgq0cj4ns6605zwx2fg64y0hcazwykr7ahrj9tsadt320

    "buildInfo": {
        "rustc": {
            "version": "1.58.0-nightly",
            "commitHash": "82af160c2cb9c349a0373cba98d8ad7f911f0d34",
            "commitDate": "2021-11-10",
            "channel": "Nightly",
            "short": "rustc 1.58.0-nightly (82af160c2 2021-11-10)"
        },
        "contractCrate": {
            "name": "adder",
            "version": "0.0.0"
        },
        "framework": {
            "name": "elrond-wasm",
            "version": "0.22.6"
        }
    },
    "name": "KothElrond",
    "constructor": {
        "inputs": [],
        "outputs": []
    },
    "endpoints": [
        {
            "name": "contractOwner",
            "mutability": "readonly",
            "inputs": [],
            "outputs": [
                {
                    "type": "Address"
                }
            ]
        },
        {
            "name": "getGame",
            "mutability": "readonly",
            "inputs": [],
            "outputs": [
                {
                    "type": "Game"
                }
            ]
        },
        {
            "name": "getGameState",
            "mutability": "readonly",
            "inputs": [],
            "outputs": [
                {
                    "type": "GameState"
                }
            ]
        },
        {
            "name": "getGamePrizeTicket",
            "mutability": "readonly",
            "inputs": [],
            "outputs": [
                {
                    "type": "GamePrizeTicket"
                }
            ]
        }
    ],
    "hasCallback": false,
    "types": {
        "Game": {
            "type": "struct",
            "fields": [
                {
                    "name": "current_games",
                    "type": "List<GameState>"
                },
                {
                    "name": "game_prize_pool",
                    "type": "u64"
                },
                {
                    "name": "game_fund_pool",
                    "type": "u64"
                },
                {
                    "name": "game_prize_tickets",
                    "type": "List<GamePrizeTicket>"
                }
            ]
        },
        "GamePrizeTicket": {
            "type": "struct",
            "fields": [
                {
                    "name": "game_prize_ticket_user",
                    "type": "u64"
                }
            ]
        },
        "GameState": {
            "type": "struct",
            "fields": [
                {
                    "name": "game_state_fee",
                    "type": "u64"
                },
                {
                    "name": "game_state_end_date",
                    "type": "u64"
                },
                {
                    "name": "game_state_current_leader",
                    "type": "u64"
                },
                {
                    "name": "game_state_particpants_list",
                    "type": "List<u64>"
                },
                {
                    "name": "game_state_prize_pool",
                    "type": "u64"
                },
                {
                    "name": "game_state_dethrone_count",
                    "type": "u64"
                }
            ]
        }
    }
}```

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions