View contracts...BlindTransfer.sol
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 { | |
View App.tsx
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> |
View index.tsx
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 |
View ExchangeRates.tsx
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 | |
} | |
} | |
`; |
View index.mjs
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 { |
View ModExp.sol
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, |
View PanicTest.sol
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; |
View miner_stop_correct_test.js
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, |
View miner_stop_test.js
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 |
View SimpleDonationManager.sol
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.6.5; | |
contract SimpleDonationManager { | |
uint256 immutable minDonation = 42; | |
uint256 immutable maxDonation = calcMaxDonation(); | |
address immutable owner; | |
constructor() public { | |
owner = msg.sender; | |
// Error: Immutables cannot be read in constructor. | |
// assert(minDonation <= maxDonation); | |
// Error: Immutables can only be assigned once. |
NewerOlder