“struktura solidności” Kod odpowiedzi

struktura solidności

struct StructName {
	uint8 text1,
    uint32 text2,
    uint8[3] textlist
    }
    
StructName MyStruct = StructName(10, 300, [5, 7, 8])

// MyStruct.text1 => 10
// MyStruct.text2 => 300
// MyStruct.textlist => [5, 7, 8]
John Appleseed

struktura w solidności

contract MyStructs {
    
    struct NFT {
        string name;
        uint256 dna;
    }
    //creating nftList of array of strct NFT
    NFT[] public nftList;
    
    function addNFT(string memory _name, uint256 _dna) public {
        // NFT memory newNFT;
        // newNFT.name = _name;
        // newNFT.dna = _dna;
        NFT memory newNFT = NFT(_name, _dna);
        nftList.push(newNFT);
    }
Shirshak kandel

Odpowiedzi podobne do “struktura solidności”

Pytania podobne do “struktura solidności”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu