Skip to content

Instantly share code, notes, and snippets.

View pom421's full-sized avatar
🦊
Yes, What's happening?

Pierre-Olivier Mauguet pom421

🦊
Yes, What's happening?
View GitHub Profile
@pom421
pom421 / script.mjs
Last active March 8, 2023 13:54
Script web3 to call a method of a smart contract
import Web3 from "web3";
import dotenv from "dotenv";
import HDWalletProvider from "@truffle/hdwallet-provider";
// We assume you have a .env file with MNEMONIC and INFURA_ID variables
dotenv.config();
const provider = new HDWalletProvider(
`${process.env.MNEMONIC}`, // Seed phrase of your wallet
`https://goerli.infura.io/v3/${process.env.INFURA_ID}` // Infura ID token
@pom421
pom421 / contracts...Projet 1 - Voting...Voting.sol
Created February 10, 2023 00:30
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Voting
*/
contract Voting is Ownable {
@pom421
pom421 / contracts...corrections...Devinez.sol
Created February 9, 2023 23:05
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract devinez is Ownable {
string private mot;
string public indice;
address public gagnant;
@pom421
pom421 / contracts...corrections...Student.sol
Created February 9, 2023 23:05
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Notes is Ownable {
struct Student {
string name;
uint256 noteBiology;
uint256 noteMaths;
@pom421
pom421 / contracts...corrections...Devinez2.sol
Created February 9, 2023 23:04
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract epargne is Ownable {
string private mot;
string public indice;
address public gagnant;
mapping(address=>bool) played;
address[] public players;
@pom421
pom421 / contracts...corrections...Deviez2.sol
Created February 9, 2023 23:04
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract epargne is Ownable {
string private mot;
string public indice;
address public gagnant;
mapping(address=>bool) played;
address[] public players;
@pom421
pom421 / contracts...Heritage.sol
Created February 9, 2023 23:04
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
/**
*
*/
contract ParentContract {
uint256 internal sensDeLaVie = 42;
@pom421
pom421 / contracts...ExternalStorage.sol
Created February 9, 2023 23:04
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "./1_Storage.sol";
interface IStorage {
function store(uint256 num) external ;
function retrieve() external view returns (uint256);
}
@pom421
pom421 / contracts...Guess.sol
Created February 9, 2023 01:05
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.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
/**
* Guess a word with a clue.
*/
contract Guess {
address owner;
string mysteryText;
@pom421
pom421 / contracts...Epargne.sol
Created February 8, 2023 19:25
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.8.17+commit.8df45f5f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
/**
* Compte épargne
*
* Cf. aussi Ownable de OpenZeppelin
*/
contract Epargne {