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 random | |
my_list = [1, 'a', 32, 'c', 'd', 31] | |
print(random.choice(my_list)) |
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 { useEthers, useEtherBalance } from '@usedapp/core'; | |
import { formatEther } from '@ethersproject/units'; | |
const { activateBrowserWallet, account } = useEthers(); | |
const etherBalance = useEtherBalance(account); | |
<p>{parseFloat(formatEther(etherBalance)).toFixed(2)} ETH</p> |
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 { useContractCall, useContractFunction } from '@usedapp/core'; | |
import { Contract } from '@ethersproject/contracts'; | |
import { ethers } from 'ethers'; | |
import simpleContractAbi from './ABI.json'; // JSON defined interface of methods | |
// smart contract deployed address | |
export const simpleContractAddress = '0xa788C207749F123bE722720b6629F6Ac52A1b8C9'; | |
const simpleContractInterface = new ethers.utils.Interface(simpleContractAbi); |
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 { FC } from 'react'; | |
import { useEthers, useEtherBalance, useContractCall, useContractFunction } from '@usedapp/core'; | |
import { formatEther } from '@ethersproject/units'; | |
import { Contract } from '@ethersproject/contracts'; | |
import { ethers } from 'ethers'; | |
// ABI definition of custom methods in JSON syntax | |
import simpleContractAbi from './ABI.json'; | |
// smart contract deployed address |
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 { useContractCall, useContractFunction } from '@usedapp/core'; | |
import { Contract } from '@ethersproject/contracts'; | |
import { ethers } from 'ethers'; | |
import simpleContractAbi from './ABI.json'; // JSON defined interface of methods | |
export const simpleContractAddress = '0xa788C207749F123bE722720b6629F6Ac52A1b8C9'; | |
const simpleContractInterface = new ethers.utils.Interface(simpleContractAbi); | |
// RPC call - reading interaction |
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 { DAppProvider } from '@usedapp/core' | |
return ( | |
<DAppProvider config={{}}> | |
<App /> | |
</DAppProvider> | |
) |