I can do it from write in the scan but in remix I can't do it, what I'm looking for is to send ETH to the contract directly from a function
Mar 26, 2023, 2:55 PM
Thanks, it works
I understand but I couldn't request a dynamic amount right? could only from web3?
Mar 26, 2023, 4:20 PM
try this maybe
func transfer (uint value) public {
IERC20(the token).transfer or transfer from
}
func transfer (uint value) public {
IERC20(the token).transfer or transfer from
}
Mar 26, 2023, 5:09 PM
I am trying directly with BNB, I think without web3 there is no way
Mar 26, 2023, 5:10 PM
show the full function youre using
Mar 26, 2023, 5:11 PM
function callDeposit() external payable {
externalContract.deposit{value: msg.value}();
}
externalContract.deposit{value: msg.value}();
}
I am trying to select the msg.value directly from the smart contract
Mar 26, 2023, 5:12 PM
🤔 it's for IERC20 interface tokens right?
Mar 26, 2023, 5:14 PM
no bro, its for BNB o ETH
Mar 26, 2023, 5:14 PM
maybe try transferFrom (sender, reciever, amount)
to have another contract recieve it (msg.sender, address(external contract), amount)
to have another contract recieve it (msg.sender, address(external contract), amount)
yeah they're also IERC20
it'll work ig
for eth or bnb or native chain just put the zero address, it defines the native token for the chain as far as I know, i don't know other alternatives to do it yet tho
Mar 26, 2023, 5:16 PM
But the transferFrom would not require approve?
Mar 26, 2023, 5:16 PM
yes it'll require, just add approveFrom before that
Mar 26, 2023, 5:18 PM
What I am trying is that my token charges an amount in BNB or ETH of commission for the transaction
Mar 26, 2023, 5:18 PM
means call the approve from function within the same parent function? I'm not too sure tho
oh 🤔, try maybe using uniswaps contracts to conduct an internal swap
Mar 26, 2023, 5:19 PM
Basically I'm just looking to collect BNB or ETH from the msg.sender as a commission for transferring my token
Mar 26, 2023, 5:19 PM
cut the fee in the token, then swap it??
ik that it's a link to an asset, but idk how to do it in bulk tbh
Mar 26, 2023, 5:20 PM
How long does it take to study bro
Mar 26, 2023, 5:20 PM
No, for example if someone transferred my Token, I want him to charge a commission in BNB
Mar 26, 2023, 5:21 PM
oh so you want a guaranteed fee rather thn depending on the liquidity
Mar 26, 2023, 5:21 PM
Like the Gas but charge BNB
Exactly, for later that commission to be injected into the liquidity pool
Mar 26, 2023, 5:22 PM
wait lemme check some repos. maybe try asking gpt how to do the specific steps, gpt works fine to explain
Mar 26, 2023, 5:22 PM
Yes, I have tried what you have told me but I have not succeeded hahah thank you
Mar 26, 2023, 5:23 PM
Babydoge or brise i forgot contract uses some similar features didn't it? auto lp or something like that
oh thanks for letting me know
Mar 26, 2023, 5:23 PM
Perfect, although now I am focusing on the function of the commission in BNB or ETH
Mar 26, 2023, 5:25 PM
Is it difficult to learn solidity based on 0 and then find a job?
Mar 26, 2023, 5:26 PM
nah it's one of the easier to learn languages, somethings are confusing tho
Mar 26, 2023, 5:26 PM
What things are confusing?
Bro
Mar 26, 2023, 5:28 PM
a lot
😂
Mar 26, 2023, 5:29 PM
For people who are not good at English, is it the biggest confusion?
😂
Mar 26, 2023, 5:30 PM
not really as long as you can understand it to some extent, it'll need more effort tho
If some docs are available in your language then it should be fine?
I asked chat gpt and it shows me this
// Function to transfer tokens while collecting fees
function transferWithFeeAndApprove(address _to, uint256 _amount) external payable {
// Calculate the fee amount
uint256 feeAmount = _amount.mul(feePercentage).div(100);
// Approve the TokenTransfer contract to spend the desired amount of tokens on behalf of the user
IERC20(tokenContract).approve(address(this), _amount);
// Transfer the tokens to the recipient
IERC20(tokenContract).transferFrom(msg.sender, _to, _amount);
// If there is a fee, transfer the fee to the contract
if (feeAmount > 0) {
(bool success, ) = address(this).call{value: feeAmount}("");
require(success, "Failed to collect fee");
emit FeeCollected(msg.sender, feeAmount);
}
// Emit the Transfer event
emit Transfer(msg.sender, _to, _amount);
}
function transferWithFeeAndApprove(address _to, uint256 _amount) external payable {
// Calculate the fee amount
uint256 feeAmount = _amount.mul(feePercentage).div(100);
// Approve the TokenTransfer contract to spend the desired amount of tokens on behalf of the user
IERC20(tokenContract).approve(address(this), _amount);
// Transfer the tokens to the recipient
IERC20(tokenContract).transferFrom(msg.sender, _to, _amount);
// If there is a fee, transfer the fee to the contract
if (feeAmount > 0) {
(bool success, ) = address(this).call{value: feeAmount}("");
require(success, "Failed to collect fee");
emit FeeCollected(msg.sender, feeAmount);
}
// Emit the Transfer event
emit Transfer(msg.sender, _to, _amount);
}
Mar 26, 2023, 5:33 PM
It sounds specified for an erc20, you say that to do it in BNB or ETH I would have to put 0x0 in the address?
Mar 26, 2023, 5:36 PM
that's why I am confused now
gpt says it also deducts an extra eth fee
Mar 26, 2023, 5:36 PM
I only know html and css. I want to learn solidity and look for a job, is half a year enough?ðŸ˜ðŸ˜
Mar 26, 2023, 5:37 PM
If you already know javascript or python, that Will be helpful
Mar 26, 2023, 5:38 PM
Me too ahahaha
Mar 26, 2023, 5:39 PM
np you can still start, I didn't have decent javascript when I started with solidity
gpt is high
Mar 26, 2023, 5:40 PM
I haven't learned these programming languages ​​now, so should I learn these first and then learn solidity?
Mar 26, 2023, 5:41 PM
Yes, but if you already know js, that Will be help you learn solidit much faster
Mar 26, 2023, 5:41 PM
yeah both are very similar
Mar 26, 2023, 5:41 PM
I mean that is ur choice, you can start learn solidity right the way, again it's a bit confusing for beginner
Mar 26, 2023, 5:42 PM
Ok thank you
Mar 26, 2023, 5:43 PM
hmm agree if you have time go for js, it's fairly decent for beginners to understand and itll also help when leaning solidity. Starting with Solidity will require some effort on your part, and a lot of practice
Mar 26, 2023, 5:43 PM
In web3, is the demand for front-end development less than that of web2? I see that many positions are recruiting back-end development engineers
Mar 26, 2023, 5:45 PM
you need the entire stack
or if you want to specialize, learn other stacks for basic proficiency so that you can handle simple tasks for that. and focus on Solidity, but for that you need to create something entirely new, youll need to prove your specialisation that way youll get a job with just proficiency in solidity I think, that's the strat I am currently following
with taking 2 years in hand to specialise in solidity, and get basic proficiency in related stacks
Mar 26, 2023, 5:48 PM
Ok thank you bro
Very very thank you
each of you is excellent
Mar 26, 2023, 5:50 PM
np , I prefer decentralisation of knowledge too lol😂
nah I am a noob trying my best
Mar 26, 2023, 5:51 PM
Follow this roadmap for solidity Dev roadmap.sh
Mar 26, 2023, 5:51 PM
I think the blockchain is very interesting, but unfortunately it is banned in our country, which makes it difficult for our learners to learn, and there are few learning materials
Okok thankyou
Mar 26, 2023, 5:52 PM
Check out freecodecamp YouTube channel bro
They just released 32 hours full blockchain course, which is excellent for me
Mar 26, 2023, 5:53 PM
China Right? Heard HongKong will be the testbed for crypto in China, so there's hope
yeah they're one of the best
this aprove doesnt work lol
The transaction has been reverted to the initial state.
Reason provided by the contract: "ERC20: transfer amount exceeds allowance".
Debug the transaction to get more information.
Reason provided by the contract: "ERC20: transfer amount exceeds allowance".
Debug the transaction to get more information.
Mar 26, 2023, 5:55 PM
You are smart, lol, yes China
Mar 26, 2023, 5:55 PM
Yup, it gave all we need to start as a blockchain Dev
Mar 26, 2023, 5:55 PM
more like addicted to crypto
also it's important as an Investor to be updated
Mar 26, 2023, 5:56 PM
what's not banned there lol
Mar 26, 2023, 6:56 PM