Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const main = async () => {
try {
const ethereum = provider()
const accounts = await ethereum.send('eth_accounts')
console.log({ accounts })
Web3EthContract.setProvider(ethereum)
const antContract = new Web3EthContract(
abi,
'0x960b236A07cf122663c4303350609A66A7B288C0'
)
const result = await antContract.methods.transfer(
'0xfD85b83369E72512A34E23fc575b96761a11F9fD', '100000000'
).send({
from: accounts[0],
gasPrice: 1000000,
gas: 8000000,
value: '1000000000000000'
})
console.log(result)
const main = async () => {
try {
const ethereum = provider()
const accounts = await ethereum.send('eth_accounts')
console.log({ accounts })
Web3EthContract.setProvider(ethereum)
const antContract = new Web3EthContract(
abi,
'0x960b236A07cf122663c4303350609A66A7B288C0'
)
const result = await antContract.methods.transfer(
'0xfD85b83369E72512A34E23fc575b96761a11F9fD', '100000000'
).send({
from: accounts[0],
gasPrice: 1000000,
gas: 8000000
})
console.log(result)
} catch (e) {
resolveEns = async () => {
const { ethNetwork } = this.props
const contracts = createContracts(ethNetwork)
try {
const [requiredStake, stakeAddress, tokenAddress] = await Promise.all([
contracts.getRequiredStake(),
contracts.ens.resolveName(ENS_NAMES.stake[ethNetwork]),
contracts.ens.resolveName(ENS_NAMES.token[ethNetwork]),
])
Web3Contract.setProvider(WEB3_URLS[ethNetwork])
const tokenContract = new Web3Contract(TOKEN_ABI, tokenAddress)
this.setState({
requiredStake,
tokenAddress,
stakeAddress,
ensError: null,
tokenContract,
contracts,
})
} catch (err) {
console.warn('err: ', err)
this.setState({
ensError: err,
})
}
}
export default (provider, options = {}) => {
Web3EthContract.setProvider(provider);
const contract = new Web3EthContract(abi, options.at);
return createSaga(CONTRACT_NAME, contract);
};
export default (provider, options = {}) => {
Web3EthContract.setProvider(provider);
const contract = new Web3EthContract(abi, options.at);
return createSaga("ERC20", contract);
};