Skip to main content

Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
27 views

why is my loop not working in below solidity code

What's happening here in the code and why is my loop not working? And one more thing, should I remove all the warnings from my code before deploying? function sub(uint n, uint a) external pure returns(...
paaras bhardwaj's user avatar
0 votes
0 answers
14 views

Hello,I wish to know if this defi flashloan code is correct and I can compile with remix [duplicate]

pragma solidity ^0.6.6; // Uniswap Deployer import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Callee.sol"; // Uniswap Manager import "https:...
Massimiliano's user avatar
0 votes
1 answer
30 views

How to send a message from one contract to another using an interface in Solidity?

Context: I am developing a smart contract system using Solidity that involves two contracts: HashedTimeLockEther (Main contract) Messenger (Interface contract) Objective: I want the ...
Nerses Asaturyan's user avatar
0 votes
1 answer
53 views

verify if a token is not a honeypot

automatically, via code, what is the best way to verify if a token is a honeypot or not. I tried: contract verified or not some external APIs (not very reliable) lint the contract
Record413123's user avatar
1 vote
0 answers
15 views

Need to perform self destruct contract

I have been involved in a scam and need to get my funds transfered to another wallet in my name. I assume there is a contract preventing send capability, so I need someone who knows how to perform a ...
Val's user avatar
  • 11
0 votes
0 answers
12 views

have you seen false calims of code using ChatGPT in Arbitrage strategy and slippage? [duplicate]

I have seen identical videos on you tube and in other sites claiming to make passive income through code from ChatGPT in Arbitrage strategy and slippage. ALL FAKE and will take your ETHER. If this ...
OndaMax's user avatar
0 votes
0 answers
10 views

Problema con stablecoin Blockchain

Buongiorno ho scritto il codice del mio stablecoin ma ho bisogno che sia visionato da un esperto per correggerlo eventualmente e creare le proxy e magari cominciare la programmazione della propria ...
enrico durante's user avatar
3 votes
1 answer
127 views

How can I use BLS12-381 curve operations:EIP-2537, Whether it's on a public or private chain

Recently I have been doing an experiment to sign smart contracts with bls12-381, but I can't find any tutorial or code for this, Is there any way to do that? please tell me if you know about it.
hai zhang's user avatar
0 votes
0 answers
37 views

Withdrawal safety from scam? [duplicate]

Thank you for taking your time to explain & help Basically i'v run a bot (from scam...) on scammed remix environnement.. I'v several error when trying to withdrawal, one of them was that there was ...
Fabien's user avatar
  • 1
0 votes
0 answers
15 views

Token Approval Removal

Someone has gotten multiple Token Approvals on my account, likely through my own fault, but I cannot tell when. they have token approvals on MATIC and ETH. so that when I transfer ETH into remove the ...
Glenn Ferrie's user avatar
0 votes
1 answer
10 views

Does this line of code make sense?

I'm looking at the following code, specifically this line "if (nOffboardingsInProgress++ == 0)", and I'm wondering about the way that line is written. Don't you need to first increment ...
user127148's user avatar
0 votes
0 answers
11 views

Would this work to add a check that a signature hasn't already been used?

I'm working on an exercise to learn smart contract security, and I am trying to add a check that a signature has not been previously used to this withdraw function. Below I put the original function ...
user127148's user avatar
0 votes
1 answer
31 views

Creating a local variable in an if statement?

I'm looking at a function that creates a local variable in an if statement. If someone called that function and the condition to the if statement was not triggered, that local variable wouldn't exist, ...
auditor_chick's user avatar
0 votes
2 answers
20 views

Explain this constructor inheritance solidity

Is BranchBridgeAgentFactory the parent contract? Will there be two different address? Or just one? pragma solidity ^0.8.0; contract TestBranchBridgeAgentFactory is BranchBridgeAgentFactory { /*////...
anonauditor's user avatar
2 votes
1 answer
83 views

Where in the code of this unstake function is ETH actually transferred?

I am looking at this repo, which is contracts for a decentralized pegged asset issuance system backed by liquid staking tokens like rETH. Specifically, I have a question about the functions unstake in ...
auditor_chick's user avatar
0 votes
0 answers
20 views

Treating two assets as equal in a smart contract that aren't equal

I am auditing a protocol that creates a token yETH representing a basket of liquid staking tokens such as rETH and stETH. I noticed that the protocol treats yETH as if it is 1:1 with ETH when it's ...
auditor_chick's user avatar
0 votes
1 answer
20 views

Can you refer to a contract inside itself?

Sorry this is a very minor question but the following is part of a contract called LibOrders.sol. The function below calls LibOrders.cancelOrder....normally I think you would just put "...
auditor_chick's user avatar
0 votes
0 answers
23 views

What happens if you divide a uint256 by a uint88 using divU64?

I am looking at the following function. It takes a uint256 (ercDebtSocialized) and uses safemath divU64 to divide it by a uint88. I assume this would just throw an error? I unfortunately cannot test ...
auditor_chick's user avatar
1 vote
1 answer
63 views

Two people calling this function at exactly the same time

I was looking at Rocket Pool's docs on interacting with other contracts and they included a simple example function that another protocol could use to accept deposits of ETH, forward it to RP, and get ...
auditor_chick's user avatar
0 votes
2 answers
66 views

Can a function call itself?

Can a function call itself...specifically, I am looking at this code and I can't figure out how this could work properly...the parameter vault would be the first parameter in the line that calls ...
auditor_chick's user avatar
1 vote
1 answer
20 views

Can you return something only some of the time with a function in solidity?

I am looking at a function that says it returns two uints, but the return statement is inside an else statement, so obviously there are conditions under which nothing would be returned. Can you have ...
auditor_chick's user avatar
0 votes
1 answer
46 views

Revert inside a for loop

If there is a revert inside a for loop that is inside a function, and the revert is triggered, will the whole function revert?
auditor_chick's user avatar
0 votes
1 answer
52 views

Can I modify a smart contract's code? [duplicate]

I get scammed big time, not proud! The worst? I can see the ETH on a watched only account. I think there's not really withdraw function at all in the code. Can I modify it to withdraw the funds and ...
Lucie Maheux's user avatar
0 votes
1 answer
23 views

Expected identifier but got ';' ? I am writing a poker game in Solidity and having problems declaring sortedCards as a state variable. Help:)

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract NoLimitPoker { address public dealer; address public smallBlind; address public bigBlind; uint public minBuyIn; ...
Etherbase's user avatar
0 votes
1 answer
19 views

Doubts on computing ETH daily number of active addresses

I am trying to compute the number of daily active addresses from the ETH's blockchain. For this, I am using this mild SQL query: SELECT date_trunc('day', block_timestamp) as day, COUNT(...
jagl's user avatar
  • 1
1 vote
2 answers
557 views

Does the EVM revert if a call is attempted to an address that doesn't have code?

The following code would revert in high-level Solidity if the provided addr is an EOA or a contract that does not implement MyInterface: interface MyInterface { function myFunction() external; } ...
Paul Razvan Berg's user avatar
1 vote
2 answers
488 views

How to concatenate 2 strings in Solidity?

Question in the title, how to concatenate 2 strings in Solidity? Googled and searched here but no luck. Please help, Thanks
Nicolas Bruckert's user avatar
1 vote
1 answer
382 views

How do I manipulate the elements of a memory array in assembly?

Simple example: Let's say I have a function that takes a fixed size array, finds the largest number in it, and returns another fixed size array in memory with the largest number as the last index: ...
EKN's user avatar
  • 31
1 vote
0 answers
39 views

Why two different source code generate same control flow graph in ethereum smart contract?

I analyzed control flow graph of two contracts written in solidity with different source code, one having vulnerability and other after resolving it. https://swcregistry.io/docs/SWC-107#modifier-...
Rue Lawliet's user avatar
0 votes
1 answer
29 views

Explain the idea of an array of contracts in solidity and the implementation of "sfStore" function in the code attached below

SimpleStorage[] public simpleStorageArray; function createSimpleStorageContract() public { SimpleStorage simpleStorage = new SimpleStorage(); simpleStorageArray.push(simpleStorage); } ...
kprabhasreddy's user avatar
0 votes
1 answer
52 views

Feasibility for Vulnerability Detection in Smart Contracts

I am excited to find out which is more feasible for vulnerability detection in ethereum smart contracts(solidity): Source Code or ByteCode and what's the reason?
Rue Lawliet's user avatar
0 votes
1 answer
41 views

Ethernaut Challenge Shop

I don't understand why remix doesn't allow me to compile this code, even though the logic is similar to the answers I found on the internet. The error: from solidity: MyContract.sol:20:11: TypeError: ...
Triple Double's user avatar
0 votes
1 answer
16 views

solidity doubt error unknown [closed]

ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. --> contracts/college.sol:104:1: | 104 | } | ^
david raj's user avatar
1 vote
1 answer
19 views

Where can I find how the Ethereum protocol calculates transaction fees, supply issuance, and other key components?

I would like to learn how different components of the Ethereum protocol are calculated. Where can see how these and other elements? Is there a code database that a final code source that I can refer ...
StatsScared's user avatar
1 vote
0 answers
40 views

how import in remix smart contract without source code?

I am trying to call a fallback function on a smart contract that has not verified contract source code, How can I do this? Thanks in advance
tomas's user avatar
  • 41
0 votes
1 answer
502 views

Can I put html code as an onChain NFT?

Can I put html code as an on-chain NFT? I don't want the NFT to be an image, I would like it to hold html code. e.g the NFT will be Hello world
Shai Kimchi's user avatar
3 votes
2 answers
5k views

how to Get All tokens against a specific Walllet Addresse?

Is It Possible to get All tokens against a specific wallet Address , whether it is deployed on a ethereum blockchain , solna , polygone or whatever ?
user103592's user avatar
0 votes
1 answer
463 views

Does address.code return runtime or creation code

You have three options to retrieve bytecode: type(C).runtimeCode which returns the runtime code of a contract, type(C).creationCode which returns the creation code of a contract and address.code which ...
Luex's user avatar
  • 61
0 votes
1 answer
17 views

Gnosis safe not letting transfer of tokesn

I have an issue with a safe that is a mutli sig and i have a token contract on there that it will not let me send any of the tokens it lets me and my others confirm it but on the execute function it ...
user96859's user avatar
1 vote
0 answers
1k views

TypeError: Operator * not compatible with types int256 and uint256 --> contracts

Fairly new at this so there's probably an obvious answer. I was just playing around with an interest bearing contract. this below works out fine: uint interestPerSecond = _interest * (_amount / 1e16); ...
torestin's user avatar
0 votes
1 answer
132 views

Store addresses in bytes variable

I need help with storing a bytes value. contract StoreBytes { bytes public addresses; function addMe() external { // TODO Add msg.sender to addresses. } } What I want is that msg....
dkb's user avatar
  • 723