Created
September 16, 2020 13:51
-
-
Save lucydjo/85ebf33a1766402485b52e0c63b8f7dc to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
//pragma experimental ABIEncoderV2; | |
contract sent974_democratic_system { | |
struct Membre{ | |
bytes32 nom; | |
bytes32 prenom; | |
address adresseCryptoPublique; | |
} | |
mapping(address => Membre) public MembreStruct; | |
address[] public array_adresseCryptoPublique ; | |
bytes32[] public array_nom ; | |
bytes32[] public array_prenom ; | |
function createUser(bytes32 nom, bytes32 prenom, address myaddress) public{ | |
MembreStruct[msg.sender].nom = nom; | |
MembreStruct[msg.sender].nom = prenom; | |
MembreStruct[msg.sender].adresseCryptoPublique = myaddress; | |
array_adresseCryptoPublique.push(msg.sender); | |
array_nom.push(nom); | |
array_prenom.push(prenom); | |
} | |
function getResult() external view returns(address[] memory, bytes32[] memory, bytes32[] memory){ | |
return (array_adresseCryptoPublique, array_nom, array_prenom); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.0 <0.6.0; | |
import "remix_tests.sol"; // this import is automatically injected by Remix. | |
// file name has to end with '_test.sol' | |
contract test_1 { | |
function beforeAll() public { | |
// here should instantiate tested contract | |
Assert.equal(uint(4), uint(3), "error in before all function"); | |
} | |
function check1() public { | |
// use 'Assert' to test the contract | |
Assert.equal(uint(2), uint(1), "error message"); | |
Assert.equal(uint(2), uint(2), "error message"); | |
} | |
function check2() public view returns (bool) { | |
// use the return value (true or false) to test the contract | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment