Questions tagged [contract-development]

Questions regarding the development of smart contracts

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

Audited ERC 20 token contract

I'm going to be launching an ERC 20 token, and I want the ERC 20 token to have an additional transaction fee of 1.05% on it. For example, if a person swaps 1 Eth for a token, I'm going to have an ...
0
votes
1answer
11 views

ParserError: Expected ',' but got '}'

I saw similar questions, but my problem is not matching any of those answered questions. I've written a function in a library that also includes in-assembly code but getting an unexpected parser error....
0
votes
1answer
17 views

contract code size to big

Good day, i have maded a smart contract but it seems to be to big i have maded some libaries such as context ownable safemath but i still keep the same message can someone mayby explain me how to ...
1
vote
2answers
33 views

ERC721 standard - What should you pass in the name and symbol arguments passed to the constructor?

I've been confused about the ERC721 standard. We pass a name and symbol to the constructor. What do they represent? In the source code, it just says token name and token symbol. Are they the name and ...
0
votes
1answer
15 views

How do I let memory array return the actual length of the value?

I want to create a fixed array(w*h), w*his the maximum size, and when the condition meet(checkOwner(_temp) == msg.sender), the data(_temp) will store into the _array. My question is if only few ...
0
votes
1answer
11 views

How to deploy smart contract without knowing the private key of deployer

I am writing an NFT smart contract for a client. Is there a way that I can deploy this contract using the private keys of his wallet so that he is set as owner while at the same not not being able to ...
0
votes
0answers
6 views

BSC-Testnet Contract verification Fails: Error! Unable to generate Contract ByteCode and ABI

I've been struggling with this with different methods. As the most straightforward, I tried manually-flattening the code in REMIX, and verifying it on bscscan. Compiler version OK, Runs for ...
1
vote
0answers
13 views

Do Normal Transactions run on the EVM?

I have read that smart contracts are compiled to bytecode and interpreted by the EVM and this changes the internal state of each node. However, I am not sure if normal transactions from address to ...
0
votes
0answers
4 views

Can a contract be the Ethereum 2.0 validator balance owner?

As we know it's not that easy to become a validator because it requires to have 32 ether. There are bypasses for lesser balance owners like staking on various websites or exchanges who can compound ...
0
votes
0answers
16 views

Uncaught (in promise) TypeError: instance.events is undefined

I am getting this error. Uncaught (in promise) TypeError: instance.events is undefined App.contracts.UkTokenSale.deployed().then((instance)=>{ console.log(instance); instance.events....
0
votes
0answers
22 views

What is the best way to handle ERC20 token payments internally in the another contract?

I'm trying to handle ERC20 token payments, using the instance of the deployed ERC20 smart contract in another smart contract, but getting the following error: contract SimpleSmartContract function ...
1
vote
1answer
19 views

How to implement indexOf in solidity?

In javascript, can use indexOf to get the index of the value. const array = [2, 5, 9]; const index = array.indexOf(5); How to implement it in solidity? I'll get the value from another function, and ...
1
vote
1answer
9 views

Can a contract check an existing transaction for validation?

I am new to smart contract development so any help or guidance is appreciated. I am thinking of creating a contract that checks if a certain transaction has already been done for validation. Is that ...
0
votes
0answers
9 views

How to allow a client to access a smart contract function/interface via a website/Metamask?

I have created a smart contract to distribute a token in exchange for ETH (very similar to this example). I'd like a user to be able to access the interface method that sends the token out on my ...
1
vote
1answer
44 views
+50

Function: null(address) in contract deployment

I try to understand the process of contract deployment and how to determine if a rug pull is possible. I am looking at the contract of the memecoin DOBO. During contract deployment a function "...
0
votes
0answers
12 views

Bond Price Formulas in Olympus DAO

In the OlympusDAO solidity smart contracts, the usage of several numbers confuses me. bondPrice(): The bond price is calculated using the formula: price_ = terms.controlVariable.mul( debtRatio() )....
0
votes
0answers
10 views

Is there a way to make sure I don't miss an emitted event?

I'm trying to listen for Transfer events emitted by an ERC721 contract. I have tried using infura as a provider but it does have some problems and I can easily miss some events (which is crucial not ...
0
votes
1answer
23 views

How to get contract address when receiving an ERC-721 token in a contract?

I'm writing an NFT staking contract and I want my contract to accept NFTs only from 3 specific contracts. I have implemented IERC721Receiver and the onERC721Received function successfully fires. What ...
0
votes
1answer
35 views

how to fetch private key of metamask account while transaction using web3.js

I have a problem, What I want is to user to come at my website, from where he/she can connect to its metamask wallet account, after connecting I want them to allow to do transaction from some specific ...
0
votes
1answer
19 views

Minting/Sending 0 Value ERC-20 Tokens in Response to Transaction in Another Contract

I currently have a working ERC-20 contract for a small group that I am in. I would like to make a new contract that mints or sends a 0 value token without liquidity similar to a rewards token that has ...
0
votes
1answer
40 views

Gas Estimation Failed idk why

the contract has 0 error's i am trying to deploy it trough injected web3 after i have full filled the constructor amounts and trying to deploy it i get this error creation of RATCOIN errored: [ethjs-...
0
votes
0answers
15 views

Migration challenges from mainnet to different L2 solutions

Due to to the high gas cost and the slowly ness on the mainnet different DeFI apps migrate to different L2 EVM based solutions. Solidity code that was written for the main-net is compatible with other ...
0
votes
1answer
17 views

How to add a mediator smart contract between wallet and another smart contract

Is there any way to achieve the following functionality.. I have a wallet, and 2 smart contracts(BankMediator and Bank). When I send eth to BankMediator(using deposit method below shown) from wallet, ...
0
votes
1answer
19 views

Type bytes memory is not implicitly convertible to expected type bytes calldata

I'm using the openzeppelin library of TimelockController.sol. Specifically using the library's schedule function. function schedule( address target, uint256 value, bytes ...
1
vote
0answers
35 views

How to Implement a Time-Locked Crowd sale with Multiple Vesting Schedule and Token Distribution for an ERC20 token PreICO, ICO & PostICO stages

I am working on a ERC20 token crowd sale project. The token distribution and vesting schedule is a little bit complicated. So Here is the scenario: Total Supply: 1,000,000,000 Token Distribution: ...
0
votes
0answers
16 views

How to allow contract function to run only after receiving gas payment

I am creating a dApp where there are 2 major stakeholders. Clients and multiple organizations. For a background on the Smart Contract, it has modifiers like onlyAdmin & onlyOrganizations. Where a ...
-1
votes
0answers
14 views

how to add fucntion batch transfer?

hello i want to know if this function of batch transfer is correct : ----------------------------- i already add this function on my contract but when i deploy the contract the fucntion dosnt work ...
0
votes
0answers
12 views

Which UML diagrams should be used for Smart contract Development?

I am a smart contract developer and I am attempting to apply the UML diagrams to the Smart Contract Development lifecycle that I am following but I am not clear as to which UML diagrams would be the ...
-1
votes
2answers
30 views

Most Popular Smart Contract (in DeFi)

We are a currently doing a research project on smart contracts. Amongst other things we are trying to find the most popular smart contracts in general and them most popular smart contracts in DeFi. ...
0
votes
0answers
15 views

SWC-126 Insuffixient Gas Griefing attack: why not simply requiring a successfull sub-call?

I'm trying to learn more about the SWC Smart Contract Weakness Classification and Test Cases. I'm stuck on understanding SWC-126: https://swcregistry.io/docs/SWC-126. Especially, I don't understand ...
0
votes
1answer
14 views

Function can send ETH without using payable?

I understand that a function must be declared as payable in order to send ETH to some address. I am trying this piece of code using Solidity 0.7.1 pragma solidity ^0.7.1; contract SendMoney { uint ...
0
votes
0answers
19 views

Error came when i tried to do batchtransfert .. any help please?

hello I just add function batch transfer to my contract .. the contract deployed with successfully but when I try to do batch transfert to other address this message came in remix etherium : ...
0
votes
0answers
16 views

Problem with events catching in web3js

So I have a function "mint" and also I have a backend code that is listening to the contract's events. The weirdest thing is that I can catch the event "TransferSingle", but I can'...
0
votes
1answer
49 views

Uncaught TypeError: Cannot read properties of undefined (reading 'Contract')

Trying to create a smart contract but keep getting a error for "bytecode" parameter. Using Local: 800 to run the code on google chrome browser. Can I get help fixing this issue ??
0
votes
0answers
9 views

How would you get total transactions submitted by an address to a specific smart contract?

If I want to see how many transactions your address has sent to Opensea's contracts over the last year - how would you do this? Would you just query etherscan? Or is there a better way?
1
vote
1answer
34 views

Do I need to initialize the 'i' variable in a for loop?

Do I need to explicitly initialize the 'i' variable in a for loop? Since i is a uint and its default value is 0, why should I spend gas in a MSTORE operation to initialize the variable with 0? The ...
0
votes
0answers
18 views

Can an attacker read value of a private variable? [duplicate]

Suppose, that I want to store and manage some confidential information with a smart contract. Also suppose, that everyone knows the source code and the address of the following contract: // SPDX-...
1
vote
0answers
23 views

How to send contract using web3gl

I tried to send contract from web3gl to BUSD. But I am not sure how to pass arguments and value. Please give me some help. // smart contract method to call string method = "transfer"; ...
1
vote
0answers
22 views

How to test overriden function with mocks

I have the following contract contract TimeHelpers { function getTimestamp() internal virtual view { return block.timestamp; } } I have the contract that inherits from this contract ...
0
votes
1answer
43 views

Want to generate non-repeative random number in a particular range

I need to generate a random number in range 1-5000 which are non duplicate. I had found solution to generate random number in particular range using chainlink and without chainlink also but i need to ...
0
votes
0answers
26 views

Signing a tuple (struct) for ECDSA.recover

I'm using web3js, and I'm trying to sign a tuple correctly. Below you can see the solidity code for verification. I'm using draft-EIP712Upgradeable.sol struct NFTVoucher { uint256 tokenId; ...
0
votes
0answers
8 views

Should I test the flattened ERC20 contract in truffle?

I have an ERC-20 contract that I have deployed successfully on the Rinkeby testnet. I have also successfully verified the contract so that I can interact with it on Etherscan. I am learning Truffle ...
0
votes
1answer
21 views

How can I query for smart contracts owned by a wallet address?

I'm playing around with programmatically forming DAOs. Essentially I want to create a frontend users can come to, type in a name, click a button and deploy a smart contract. I'd like to display a list ...
0
votes
0answers
28 views

Cannot remove Liquidity - BSC contract

I used a pre-made contract and after launching it, I cannot remove the liquidity from the Owner account. Some people bought. Would like to know why is it. Basically, it says that the Owner acc only ...
0
votes
0answers
16 views

How "polymath" is doing "Ticker symbol reservation" on Ethereum?

So, from what I understand it is not possible to reserve the ticker symbol on the Ethereum network (I read this and this) But I am trying to understand what the Polymath is doing by "Ticker ...
0
votes
1answer
17 views

What is the best practice when importing Contracts

I will try to clarify my questions with visual aid. The picure above is how I usually import contracts. For example, I import Both C and B contracts to A, even though B already imports C too. ...
0
votes
0answers
17 views

Solidity error basic programme

I am not able to find the error to this problem Can anyone please help me with it It is showing that hasDeceased function is having some error... Not able to access the function ...
0
votes
1answer
22 views

Ways to invoke contract methods

I'm just starting learning development on Ethereum. So far I created a couple of local projects using truffle / web3js / react-native. Right now I started solving exercises on https://ethernaut....
0
votes
1answer
16 views

How do I pay functions in remix?

I am making an NFT vending machine. Here's the code: // SPDX-License-Identifier: MIT pragma solidity ^ 0.8.10; contract VendingMachine { address payable internal vendingAdmin; struct item { ...
0
votes
1answer
55 views

How to add a fee for each swap

I'm making a small NFT tool and I'm having troubles calculating the fee and making the user pay for it, the fee itself is 0,10% and I want to apply it to each time the function createMarketSale is ...

1
2 3 4 5
83