CRYPTO NEWS

Calling a function, but get a transfer instead of call function in etherscan

I’m trying to solve some problems on Capture the ether

Sometime it feels like the contract are badly deployed.

This is my code trying to call the lockInGuess function (don’t really read it, summary: I call lockInGuess, the smart contract is showing something strange instead) :

import { ethers } from "hardhat"; import { BigNumber, Contract, Signer } from "ethers";  let accounts: Signer[]; let eoa: Signer; let contract: Contract;  before(async () => {   accounts = await ethers.getSigners();   eoa = accounts[0];   const challengeFactory = await ethers.getContractFactory(     "PredictTheBlockHashChallenge"   );   contract = challengeFactory.attach(     `0xF248f7AF04D5c89fC9C957F570999086F35F0626`   ); });  it("solves the challenge", async function () {   // LockInValue 0 at guess (only call one time)   await contract.lockInGuess(     `0x0000000000000000000000000000000000000000000000000000000000000000`,     {       value: ethers.utils.parseEther(`1`),       gasLimit: 1e7     }   );    const bigNumber = await contract.provider.getStorageAt(contract.address, 2)   const settlementBlock = BigNumber.from(bigNumber)   const blockNum = await ethers.provider.getBlockNumber()   console.log('blockNum: ', blockNum);   console.log(`SettlementBlock number was ${settlementBlock}`)   const diff = blockNum - settlementBlock   console.log('diff: ', diff);   const guess = await contract.provider.getStorageAt(contract.address, 1)   console.log('guess: ', guess);   const guesser = await contract.provider.getStorageAt(contract.address, 0)   console.log('guesser: ', guess);  });  

I’m running this with Hardhat, on the Ropsten network.

I’m running the lockInGuess function of the smart contract only when I need it.

I’ve noticed that sometimes, it feels like the contract is badly deployed because when I’m watching the interaction with it on Etherscan, it either gives me a good methods call (in my case lockInGuess, but some other time it’s blocked, and I only see Transfer*. Every time I have a smart contract showing Transfer*, it does not behave as supposed to be.

Example And when I check the contract here: https://ropsten.etherscan.io/address/0xF248f7AF04D5c89fC9C957F570999086F35F0626 strangely the method is Transfer and not lockInGuess

Here is the same contract redeployed:

We can see here the same contract, behaving as it should be: https://ropsten.etherscan.io/address/0xbcf43e5d0e7fba84fa6925a7c706c82745e8915d .We can see that it’s not transfer showing but the method Lock In Guess.

Why is that?

Are stale blocks permanently discarded?

I know that stale blocks usually happen by accidents and the chain that has more blocks will be chosen as canonical chain by default and the stale chain is discarded. My question is about what it means to be discarded? Is it permanently discarded or does it mean that if those stale blocks become longer::Listen

I know that stale blocks usually happen by accidents and the chain that has more blocks will be chosen as canonical chain by default and the stale chain is discarded.

My question is about what it means to be discarded? Is it permanently discarded or does it mean that if those stale blocks become longer (from 51% hash rate mining), they will stop being stale and be preferred by nodes?

I simply want to know whether it’s possible to alternate mining between 2 chains making them roughly equal in length when you have 51% hash rate so that the network becomes useless. I think that it doesn’t make sense that stale blocks are completely discarded. Because that means the longest-chain rule is not obeyed. If you obey longest-chain rule, stale blocks must always have a chance to become part of the canonical chain no matter what.

Crypto Hats, Crypto Shirts, Crypto Socks, Crypto Clothing

Calling a function, but get a transfer instead of call function in etherscan

Shopping cart
There are no products in the cart!
Continue shopping
0