// SPDX-License-Identifier: GPL-3.0

Hello i need help for a code about two dimension array,
it dont create smart contract beacause, i cant init array but this is necessary by my code;
this my code:

pragma solidity >=0.7.0 <0.8.0;


contract Smart2 {


struct Play {
address payable player;
uint256 timestamp;
}


Play[][] public seassons;

constructor() {
//1 not working (Compiled)

seassons[0][0]= Play(msg.sender, block.timestamp);


//2 not working (Compiled)
// Play storage player = seassons[0][0];
// player.player = msg.sender;
// player.timestamp = block.timestamp;

//3 not working (Compiled)
// seassons[0].push(Play(msg.sender, block.timestamp));

//4 not working (not Compiled) (ERROR: Copying of type struct Smart2.Play memory[1] memory to storage not yet supported.)
// seassons.push([(Play(msg.sender, block.timestamp))]);


}

}

ERROR when deploy contract:
"
creation of Smart2 pending...

[vm] from: 0x5B3...eddC4to: Smart2.(constructor)value: 0 weidata: 0x608...40033logs: 0hash: 0xb61...8df7b
creation of Smart2 errored: VM error: invalid opcode. invalid opcode The execution might have thrown. Debug the transaction to get more information.
"

Jan 31, 2021, 9:46 PM
Where is the definition of seassons?
Jan 31, 2021, 9:51 PM
at the beginning under struct
Jan 31, 2021, 9:53 PM
Here you go:
https://ethfiddle.com/GnFzdQha-h
Please not that
1) I have changed code (so "Works" means I changed it) and
2) I used compiler version 0.8.0. If you use a different one, it might no longer be compatible.
Jan 31, 2021, 10:01 PM
Thanks you!!, but the problem is that not deploy the contract
or with code working? i try remix for the deploy
with you code working?*
Jan 31, 2021, 10:12 PM
You have to use my code. Try it in the VM first. In my tests it worked.
Jan 31, 2021, 10:13 PM
many thanks! bro!!!!!
Jan 31, 2021, 10:16 PM
you're welcome :)
Jan 31, 2021, 11:31 PM

© 2024 Draquery.com All rights reserved.