This file contains 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.5.0; | |
contract HelloWorld { | |
string public sentence; | |
constructor() public { | |
sentence = "HelloWorld !"; | |
} |
This file contains 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
const Migrations = artifacts.require("Migrations"); | |
const HelloWorld = artifacts.require("HelloWorld"); | |
module.exports = function(deployer) { | |
deployer.deploy(Migrations); | |
deployer.deploy(HelloWorld); | |
}; |
This file contains 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
function concat(string memory _base, string memory _value) internal pure returns (string memory) { | |
bytes memory _baseBytes = bytes(_base); | |
bytes memory _valueBytes = bytes(_value); | |
string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length); | |
bytes memory _newValue = bytes(_tmpValue); | |
uint i; | |
uint j; |
This file contains 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.5.0; | |
contract HelloWorld { | |
string public sentence; | |
string public userName; | |
constructor() public { | |
sentence = "HelloWorld !"; | |
userName = "Guillaume"; | |
} |
This file contains 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import * as serviceWorker from './serviceWorker'; | |
import { Drizzle } from "drizzle"; | |
import HelloWorld from "./contracts/HelloWorld.json"; | |
const options = { |
This file contains 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
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import HelloWorld from "./HelloWorld"; | |
class App extends Component { | |
state = { loading: true, drizzleState: null }; | |
componentDidMount() { | |
const { drizzle } = this.props; |
This file contains 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
import React from "react"; | |
class HelloWorld extends React.Component { | |
state = { sentence: null }; | |
componentDidMount() { | |
const { drizzle, drizzleState } = this.props; | |
const helloWorld = drizzle.contracts.HelloWorld; | |
const sentence = helloWorld.methods["saySomething"].cacheCall({ from: drizzleState.accounts[0], gas:3000000}); |
This file contains 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
import React from "react"; | |
import Button from 'react-bootstrap/Button'; | |
class HelloWorld extends React.Component { | |
state = { sentence: null, newSentence: "", stackId: null }; | |
changeSentence = e => { | |
this.setState({newSentence: e.target.value}); | |
} |
This file contains 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
totalSupply() public view returns (uint256 totalSupply) | |
#Fonction permettant d'obtenir le nombre de tokens existants. | |
balanceOf(address _owner) public view returns (uint256 balance) | |
#Fonction retournant le nombre de tokens qu'une adresse possède. | |
transfer(address _to, uint256 _value) public returns (bool success) |
This file contains 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
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId) | |
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); | |
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); | |
#Ces événements permettent d’afficher des informations lors de modifications, transfert de token par exemple. | |
function balanceOf(address _owner) external view returns (uint256); |
OlderNewer