Questions tagged [contract-design]

for high-level questions about the choices made during contract construction

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

unable to sell token despite seeing other wallets selling

I bought this token on base network and the contract looks perfect to me, but i realize i was unable to sell/swap the token after increasing the slippage to 50%, i can see other wallets selling and i ...
Job Toni's user avatar
0 votes
1 answer
31 views

Is it possible to create a transaction as an admin and send it but with someone else paying for the gas fees?

I have a mintToken method in my smart contract that is onlyAdmin. The problem I have is that I don't want to pay for the transactions for my users every time I execute this function (and it also can't ...
Falcon Stakepool's user avatar
1 vote
0 answers
24 views

Does this token contract look right?

I am not a coder or even thought about code until my run in with one of these guys (smart contract) and ill be honest its been rather interesting trying to work this out and learning a lot i think ...
DaV08900's user avatar
0 votes
1 answer
15 views

Sent Eth to contract address can I get it back

I sent some Eth to a contract address rather than my wallet. Can someone with some code experience have a look at this contract and let me know if there is a function on here that the Devs could use ...
Fez's user avatar
  • 3
1 vote
1 answer
48 views

getting address field from assembly

Assume the following solidity code: function caller(uint k, uint v) public { (bool success, ) = address(this).call(abi.encodeWithSignature("callee()", abi.encode(k, v, msg.sender))); ...
Giorgi Lagidze's user avatar
0 votes
1 answer
44 views

Transaction Hijacking?

So I created a wallet and sent it some funds then I submitted a few invalid transactions. I approved the correct address for transferring wrapped eth. After the approval my script immediately sent the ...
Samuel Wagner's user avatar
3 votes
1 answer
84 views

What's type hash's usecase in EIP-712?

Assume I'm implementing EIP-712 signatures in solidity. contract Nice { bytes32 private constant BID_TYPE_HASH = keccak256("Bid(uint256 num1,uint256 num2)"); struct Bid { uint256 ...
Neo's user avatar
  • 93
1 vote
0 answers
16 views

How can I design smart contracts for p2p vehicle trading?

The idea is to have two contracts: OrderManager Contract NFTMinting Contract OrderManager will manage the funds transfer for the vehicle; buyer will deposit the funds, the seller will withdraw them; ...
Geek's user avatar
  • 21
1 vote
2 answers
67 views

msg.sender vs owner

Is it bad practice (or risk prone) to use owner instead of msg.sender when checking actions initiated by a caller? ...even if I check that owner is authorized by msg.sender to do the mentioned actions?...
dNyrM's user avatar
  • 894
0 votes
1 answer
32 views

Will upgrading a smart contract to inherit from a new base class cause potential storage conflicts with UUPS proxy pattern?

I have an ERC20 contract like so: contract myToken is ERC20BurnableUpgradeable, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable { mapping(address => uint256) public totalSpent; ...
Barney Chambers's user avatar
0 votes
0 answers
14 views

there is a bot code on you tube [duplicate]

there is a bot code on you tube, where can i go to check if its a scam> here is the code. code: https://codepastes.com/raw/wJLpHt you tube: https://youtu.be/a2oGKFSWhuk?si=gJiqVdatk17qXi2f
Francisco Alvarado's user avatar
0 votes
0 answers
33 views

My contract level metadata is not showing on Opensea!

I need some help I'm new to solidity and I'm reading the docs for opensea, but I must be missing something. I have an ERC721 contract on Polygon, but the contract level metadata won't show. I'm ...
Ordo's user avatar
  • 1
0 votes
1 answer
20 views

re-revert error data with non-external function

my question is how what if one of swaps in doSwapChain revert how i can re-revert that error(UniswapV2 error) with my error that have the index number of the swap and also the error that reverted(...
CorrM's user avatar
  • 15
1 vote
3 answers
71 views

Transanction rejected by EVM when i tried to call a claim function from an airdrop contract

This my contract /** contract JayTechAirdrop { address public owner; address public jayTechTokenAddress; uint256 public claimAmount = 1e6 * 1e18; // 1 million JayTech tokens uint256 public gasFee; ...
Hallenjay's user avatar
0 votes
0 answers
31 views

Efficient Storage Strategies for ERC721 with Editable Content

I'm just starting to learn about smart contracts, Ethereum and NFTs. It's all new and I need your help with managing editable NFTs. I want to create a NFT with content that is easy to modify while ...
user9541033's user avatar
0 votes
1 answer
32 views

GoFundMe Contract: Minting "Thanks" over time vs all at once & "Thanks" token value

I was assigned to write a smart contract for class (to be deployed on a test-net), which, upon receiving ETH, returns to the sender some amount of tokens with symbol "Thanks". I want this ...
Alex Byard's user avatar
0 votes
1 answer
108 views

Bought a scam token, trying to understand what part of the code should I check next time to prevent that

Contract code - https://etherscan.io/token/0x67bcd18a484a88f073097a18b0462eb7c44d3178#code Ownership renounce at 08:17 UTC https://etherscan.io/tx/...
Dan's user avatar
  • 1
0 votes
0 answers
13 views

How can I mimic legacy bank in my project?

I want to build a project where legacy bank interacts with blockchain networks (over CCIP). Please suggest me how can I mimic a legacy bank - as a separate project or any different idea is appreciated....
Inderdeep01's user avatar
0 votes
1 answer
35 views

How do I add my address to a deployed contract public address using a security exploit? (coding challenge)

I'm working on a coding challenge for smart contract security exploits. I need to add my address to public address (browerr) in the contract. Do I need to create another contract that inherits the ...
johnTg's user avatar
  • 1
3 votes
2 answers
76 views

Are storage variables tightly packed like struct fields?

Tight variable packing is a known coding pattern in Solidity for saving gas by placing struct fields that are lower than 256 bits closer to one another. Does this logic apply to storage variables? ...
Paul Razvan Berg's user avatar
0 votes
1 answer
34 views

How do you use the Diamond Pattern for escrow upgrades?

I am creating a contract with the diamond pattern so I can evolve and add new features to my contract. Contract facets: Contract A: an ERC721 that takes care of minting its own NFTs Contract B: ...
Piyush Chittara's user avatar
0 votes
1 answer
19 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
1 vote
1 answer
82 views

Why do some developers make their base contract inherit its Interface?

Some protocols and developers inherit the contract's Interface inside of the base contract and then have the interface contain the actual NatSpec, is this simply for human readability/code ...
Rohan Nero's user avatar
  • 1,577
0 votes
1 answer
253 views

How much does it cost to clog the Ethereum Network exactly?

Currently the largest gas guzzler to clog the Ethereum network is the Mint contract below. Supposedly there are users purposely causing high gas prices using this function. Why would anyone do this ...
Patoshi パトシ's user avatar
0 votes
0 answers
27 views

Function Visibility specifiers during inheritance

when am overriding a function in solidity must my child function have the same visibility as the parent function? can the parent function be public and the child function be internal
Emmanuel Anah's user avatar
0 votes
0 answers
23 views

Token Rewards Calculation and Distribution

I'm doing a script to calculate rewards for a handful of addresses (from sensors). The script runs weekly where it takes a bunch of addresses from our DB, cleans the data and calculates the associated ...
gritty's user avatar
  • 1
1 vote
2 answers
77 views

Malicious smart contract that transfers tokens forth and back

Sorry if my question was already discussed. Is it possible to implement such a smart contract or contracts that in result can transfer eth or ERC20 tokens forth from ANY to B account and back from B ...
Oleg's user avatar
  • 11
0 votes
1 answer
29 views

Can an individual NFT that's not been minted yet have a whitelist?

As it's not been minted yet, it doesn't exist, right? However, what if I had an idea to create a future collection of 333 NFT. And I wanted to allow certain users to mint certain NFTs. Meaning, future ...
DankenN's user avatar
  • 47
0 votes
0 answers
91 views

How to re-mint NFTs to the existing holders?

Suppose, I've created an NFT collection of V1, of ERC751 or ERC1155. After some time, I've discovered that I want to fix a bug or improve it in some way, and this will become V2. I'll then go ahead ...
DankenN's user avatar
  • 47
0 votes
1 answer
464 views

Not able to sell token, where is the tricky code in it

I bought a small amount of this token, but later on doing some more research I found old projects from the creator scamming people: 0x746a2890c506E11597D0b5d805f7d4d6E980667D im not able to sell that ...
Marcel Dz's user avatar
  • 103
0 votes
1 answer
380 views

How to find owner of contract deployer on etherscan website

https://etherscan.io/address/0x6cfa7561bbf940ab4b5c0507d4c9e45c68552b1b On the Etherscan website, where or how do i navigate to the deployer wallet of this contract? Apparently if i look closely at ...
Jim41Mavs's user avatar
  • 103
2 votes
1 answer
125 views

Do immutable variables influence the contract bytecode?

Suppose you have a contract like this: pragma solidity >=0.8.19; contract Bar { uint256 public immutable value; constructor(uint256 value_) { value = value_; } } Will Bar ...
Paul Razvan Berg's user avatar
0 votes
0 answers
81 views

Does gas optimization only apply to leading zeros in contract addresses?

I couldn't find any solid information on this. From assembly perspective clearly PUSH2 0xC0FE for a two byte address 0xC0FE requires less memory than a full PUSH20, but I could swear I also read any ...
Zommuter's user avatar
  • 113
0 votes
1 answer
19 views

How to call a read function within "contract B1" when the function is defined in a higher contract that imports "contract B1" as an extension?

I want to use the totalSupply function within an extension contract, but the function is not declared within the contract and is added in from a different contract extension. Both extensions are ...
Nunber1's user avatar
0 votes
0 answers
30 views

Changing the datatype of one property in a struct goes over the contract size limit?

Given this struct struct Marker { string Key; string Category; bool Include; } Our contract compiles within the size limit. But changing it to struct Marker { bytes4 Key; bytes12 ...
ThomasS's user avatar
  • 13
1 vote
1 answer
2k views

bought a token that is unsellable, but I do not spot the code in the contrat that is responsible

I bought this token, had a good app for trading and a well written medium which didn't seem scammish at all. the token even managed to pass on the normal basic tools for honeypot detection and ...
user119739's user avatar
2 votes
1 answer
65 views

Is there any way to selectively include logic in a contract during its construction?

We have a contract that adheres to the ERC-3156 standard, which provides flash loan functionality. We intend to deploy this contract multiple times, and in certain cases, flash loan capabilities are ...
Paul Razvan Berg's user avatar
2 votes
2 answers
437 views

restrict the NFTs of my contract (ERC721) to be traded on marketplaces?

Are there tricks in solidity to prevent the NFTs minted by an ERC721 contract to be (a) not recognizable and (b) not being transferable by marketplaces like OpenSea, SuperRare. I see those possible ...
Majd TL's user avatar
  • 3,217
2 votes
2 answers
327 views

Why's it all being displayed as Big Number if I am using ethers.utils.parseEther? Is this normally how it displays in console?

In my hardhat test file I am converting ERC20 tokens transactions/balances with ethers.utils.parseEther like... const ONE_ETHER = ethers.utils.parseEther("1"); So if everything is being ...
Blockpain's user avatar
  • 173
1 vote
1 answer
198 views

Troubling shooting hardhat test failure - ERC20 approve & transferFrom issues

One of my hardhat tests is failing and I am hoping someone assist with. I have 2 smart contracts posted here and the test file I am running. My question is at the bottom. It's a bit lengthy to look ...
Blockpain's user avatar
  • 173
1 vote
1 answer
29 views

Is this problem a front-running or race-condition or something else?

What is the correct name of this problem in audit terms? If I have a contract that sells NFTs. The address with the most NTFs has a very high chance to win a prize. The problem is that 1 address can ...
Majd TL's user avatar
  • 3,217
0 votes
1 answer
49 views

ERC1155 and ERC1155UriStorage Question

For anyone who has worked with Open Zepp's ERC1155 and ERC155UriStorage. Both of them have a _setURI function and a uri function (returns the token uri). 2 questions when using both of these ...
Blockpain's user avatar
  • 173
1 vote
0 answers
43 views

Creating two separate funds in a single smart contract

I am attempting to create a smart contract with two separate funds/ vaults. So far, I have approached it by creating two separate payable functions, arrays, and mappings with separate permissions for ...
Ryan Glenn's user avatar
1 vote
1 answer
19 views

My payout function to lottery winners is failing. I'm storing the winners in an array and attempting to payout but getting reverts

the code: function payoutWinners() public payable { require(msg.value >= payoutOwed, "send more than what is owed"); for (uint i = 0; i < winningAddresses.length; ...
snejad123's user avatar
2 votes
2 answers
152 views

Why does a contract store how much eth it's been sent, internally?

Beginner question: In one or two smart contracts samples, I've seen that a function is payable but the smart contract seems to hold its own state on the total it has received, e.g. total += msg.value. ...
Luke Puplett's user avatar
1 vote
0 answers
9 views

Instantiate contract from clone factory with value [duplicate]

I'm currently trying to create instances of a smart contract via a clone factory. The problem is, that I'm not able to send a value to the init function of the smart contract I'm trying to instantiate....
unsigned_int2's user avatar
0 votes
1 answer
34 views

how to fix the phrase error: Expected ','but got ;

// SPDX-License-Identifier:MIT pragma solidity ^0.8.0; import "@openzeppelin/[email protected]/token/ERC20/ERC20.sol"; // The contract's name is "CryptoInsurancePolicy" contract ...
Brendan Shawn's user avatar
0 votes
1 answer
1k views

how does this honeypot works on BSC - it allows swapping from BNB but not reverse, can't even add BNB liquidity using it

This honeypot token can't even detected by Honeypot Detector tools, can I get a sense how does this honeypot works from contract level, so keep myself safe in the future? Scam Token (Do not buy!): ...
newbielearner's user avatar
1 vote
0 answers
123 views

How to code a zk roll-up in Solidity smart contracts?

Zksync is a protocol that recently enabled its layer-2 technology to directly admit layer-1 Solidity code for deploying on Zksync. Aren't zero-knowledge proofs difficult to code using Solidity ...
user610620's user avatar
  • 1,518
1 vote
2 answers
78 views

How can someone prove they are 18+ by smart contract?

Smart contracts are permission-less (no KYC) and decentralized, therefore, censorship resistant. IRL Smart contract applications range from ownership of digital paintings to proof of birth ...
user610620's user avatar
  • 1,518

1
2 3 4 5
42