Skip to content

Instantly share code, notes, and snippets.

@adrianescutia
Last active August 14, 2020 00:35
Show Gist options
  • Save adrianescutia/0e8d9d2539d05e84edca75b1a9d1b4b8 to your computer and use it in GitHub Desktop.
Save adrianescutia/0e8d9d2539d05e84edca75b1a9d1b4b8 to your computer and use it in GitHub Desktop.
Smart Contract to create the array needed to test Remix example of 3_Ballot.sol, with this array you would be able of deployment & run Ballot
pragma solidity >=0.6.6 <0.7.0;
/**
* @title ProposalNamesForConstructor
* @dev Implements a Contract to create the array to test 3_Ballot.sol deployment & runs it
* Based on stackexchange answer: https://ethereum.stackexchange.com/a/59172
*/
contract ProposalNamesForConstructor {
function getBytes32ArrayForInput() pure public returns (bytes32[3] memory b32Arr) {
b32Arr = [bytes32("candidate1"), bytes32("c2"), bytes32("c3")];
}
}
@adrianescutia
Copy link
Author

Result of running the smart contract:
bytes32[3]: b32Arr 0x63616e6469646174653100000000000000000000000000000000000000000000,0x6332000000000000000000000000000000000000000000000000000000000000,0x6333000000000000000000000000000000000000000000000000000000000000

Paste this in the "Deploy" Argument to deploy contract:
["0x63616e6469646174653100000000000000000000000000000000000000000000","0x6332000000000000000000000000000000000000000000000000000000000000","0x6333000000000000000000000000000000000000000000000000000000000000"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment