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.8 <0.9.0; | |
/** | |
* @title Storage | |
* @dev Store & retrieve value in a variable | |
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts | |
*/ | |
contract BitShiftTest { | |
uint256 number; |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.7.0 <0.9.0; | |
/** | |
* @title FlashTransfer | |
* @dev Simple blind transfer contract | |
*/ | |
contract BlindTransfer { | |
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 './App.css'; | |
import './ExchangeRates' | |
import ExchangeRates from "./ExchangeRates"; | |
export default function App() { | |
return ( | |
<div> | |
<h2>My first Apollo app 🚀</h2> |
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 reportWebVitals from './reportWebVitals'; | |
import fetch from 'cross-fetch'; | |
import { gql, ApolloProvider, ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; | |
const endpoint = 'https://48p1r2roz4.sse.codesandbox.io' // apolloのGetting Started |
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 {gql, useQuery} from '@apollo/client'; | |
const EXCHANGE_RATES = gql` | |
query GetExchangeRates { | |
rates(currency: "USD") { | |
currency | |
rate | |
} | |
} | |
`; |
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 fetch from 'cross-fetch'; | |
import { gql, ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; | |
const client = new ApolloClient({ | |
link: new HttpLink({ uri: 'https://48p1r2roz4.sse.codesandbox.io', fetch }), | |
cache: new InMemoryCache() | |
}); | |
client | |
.query({ | |
query: gql` | |
query GetRates { |
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.8.1; | |
contract ModExpContracts { | |
address public constant modExpAddress = 0x0000000000000000000000000000000000000005; | |
bytes public _result; | |
function modExp( | |
uint baseLength, |
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.8.0; | |
contract CalledContract { | |
uint[] nums; | |
function onlyEven(uint256 a) external pure returns(uint) { | |
uint b = 300 / a; | |
require(b % 2 == 0, "Ups! Reverting"); | |
return b; |
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 pify = require('pify') | |
async function queueTransaction(from, to, value, nonce, gasLimit, data) { | |
const response = await pify(web3.currentProvider.send)({ | |
jsonrpc: "2.0", | |
method: "eth_sendTransaction", | |
id: new Date().getTime(), | |
params: [ | |
{ | |
from: from, |
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
it('multi transfer in same block', async () => { | |
web3.extend({property: 'mine', methods: [{ name: 'start', call: 'miner_start', params:0}]}) | |
web3.extend({property: 'mine', methods: [{ name: 'stop', call: 'miner_stop', params:0}]}) | |
const instance = await MyERC20Token.new() | |
const beforeBlock = await web3.eth.getBlockNumber() | |
await web3.mine.stop() | |
// queued tx1 |
NewerOlder