How do I know what and what not I can pass to contracts?

Oct 3, 2021, 8:45 AM
Oct 3, 2021, 8:45 AM
Address..
Oct 3, 2021, 8:53 AM
It's address variable
But I have encountered many times in past
This thing
Passing any argument, to contact
I don't know , if I'm messsing something, can't understand this
Oct 3, 2021, 8:57 AM
Function setKittyContractAddress(address
Oct 3, 2021, 8:57 AM
Yeah I know that
But u can see that argument passed to a contract called 'kittyInterface'
KittyInterface is a contract, How is it possible to pass argument to it?
Oct 3, 2021, 9:05 AM
You can't
You are not passing argument to interface
You are linking an interface to the address _address
Oct 3, 2021, 9:14 AM
Oh got it, so a contract can only be linked to a address right?
Can u tell me, what _address will be here?
Will it be kitty erc721 contract?
Oct 3, 2021, 9:16 AM
You are telling 'your contract' that another contract at address '_address' have functions which are defined in kittyinterface
_address will be the contract's address which have implemented getKitty method
Oct 3, 2021, 9:18 AM
@grimreaper619 what does this green underlined line of code means?
Declaring a variable a contract data type? πŸ₯Ά
Oct 3, 2021, 9:22 AM
That is the "link"
A reference to actual kitty contract
The function below is the linking process
Oct 3, 2021, 9:23 AM
I still don't understand
now confused on the things you mentioned above
Oct 3, 2021, 9:25 AM
For example, you have contract A
There is a different contract B which have a function abcd()
Contract B is deployed on address 0xb
You want to call the function abcd() from contract A on contract B
But contract A does not know where contract B is
So we create a link
By saying, 'contract B is deployed on address 0xb with functions such as abcd() available'
Oct 3, 2021, 9:28 AM
Yes, those are available on Contract B's interface
But I have written those in my my solidity file, by creating new contract called kitty interface, so I have 3 contracts now?
I will interact with interface that is deployed on ethereum
But why I have to write that interface code again, creating new contract?
Oct 3, 2021, 9:30 AM
Interface does not do anything on its own
Interface basically says 'There is a function named abcd(), which takes these parameters and ouput this parameter'
It does not know what happens inside abcd()
Oct 3, 2021, 9:32 AM
Can u paste any code snippet as well, so I can know what it will look like finally
I think I am not interacting with actual crypto kitty contract, that's why I have to write crypto kitty interface in my contract
Creating another copy on crypto kitty interface.
Oct 3, 2021, 9:34 AM
interface IWalletStore {

event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);

function isVerified(address) external view returns (bool);

function addUser(address _address) external returns (bool);

function getVerifiedUsers() external view returns (address[] memory);

}
This is an example interface
As you can see, no function definitions
It just says this function takes these parameters and returns this parameter
Function definition will be on the actual implementation of this interface
Oct 3, 2021, 9:35 AM
yea, so let's say this is interface of contract B, the example you gave above
So, If I want to access the function isVerified of contract B in contract A
Then I will have to use this interface as well?
And how will I use this interface for contract A
Oct 3, 2021, 9:36 AM
1) You should have contract B deployed separate
2) You should import this interface on contract A
3) Create a link to contract B like in the pic you shared
4) If you named that link as walletInterface for example, you can then call isVerified function from contract A like
walletInterface.isVerified(_address)
_address here is just a random address, not contract address
Oct 3, 2021, 9:40 AM
πŸ™πŸ”₯
contract Ownable {
address private _owner;

event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);


constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
Saw this ownable contract on openzappeline
Why it says, ownership rights was earlier to address(0)?
I agree that it has given to msg.sender now
Oct 3, 2021, 10:15 AM
Constructor is called on deployment so the owner is the one who's deploying it
Oct 3, 2021, 10:16 AM
Ohh that's understandable, but I saw emit event says previous owner was address(0)
Oct 3, 2021, 10:19 AM
Empty address = address(0)
Oct 3, 2021, 10:23 AM
Got it, it's like 0 for int data type
Oct 3, 2021, 10:26 AM
@JoshHale Read from here
Oct 5, 2021, 6:19 PM
.
another is this one
Where I am struggling to get it properly
Oct 9, 2021, 7:16 AM
It's just like int or string
But with a lot more functuons
Oct 9, 2021, 7:16 AM
make sense
Oct 9, 2021, 7:16 AM
It's initiating a new type of kitty interface
Oct 9, 2021, 7:16 AM
like?
Oct 9, 2021, 7:17 AM
The functions you put in the original interface of kitty interface can be accessed like this
Kitty contract. your function
Oct 9, 2021, 7:17 AM
wow nice
what line of code inside function setkittycontract doing?
Oct 9, 2021, 7:19 AM
It can access all functions inside kitty contract
I'll show you
Oct 9, 2021, 7:20 AM
But why passed an address as argument?
Oct 9, 2021, 7:20 AM
This is how you access different contract
If you want to interact with uniswap you do this
Oct 9, 2021, 7:21 AM
So I have to paste code of uniswap interface first?
Oct 9, 2021, 7:21 AM
yes
Oct 9, 2021, 7:22 AM
and then copy contract address of core contract with functionallity I want
Oct 9, 2021, 7:22 AM
Yes
Oct 9, 2021, 7:22 AM
and the function I am accessting from uniswap contract, that function should be available in the interface I copy pasted
without any implementation
just refrence
I don't understand reason of this
why?
If I am accessing original contract by it's deployed adress
then it will give me access to all the functions
why I need to copy paste interface again?
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
asking 1 more question don't know if make sense
There are events in ownable that shows ownership transfered from old Owner to new owner
constructor() {
_transferOwnership(_msgSender());
}
and it does at deployment as well
So is there any other early owner than deployer?
Like when txn is pending?
What this event refer to as previous owner here?
Oct 9, 2021, 7:43 AM
No
The owner is address (0)
Oct 9, 2021, 7:49 AM
Yes this, I want to know
So owner is address 0 before msg.sender?
address(0) is dead address right?
Oct 9, 2021, 8:34 AM
Yes
Oct 9, 2021, 8:35 AM
0x0000000000000000000000000000000000000000
Oct 9, 2021, 8:35 AM
Constructor is the first call on deployment
Yes
This is also an empty address
Oct 9, 2021, 8:35 AM
So when address 0 is owner?
Oct 9, 2021, 8:35 AM
If you put address some address;
Oct 9, 2021, 8:35 AM
before deployment?
Oct 9, 2021, 8:35 AM
If you deployed this
Even if this is empty
It will show address (0)
Oct 9, 2021, 8:36 AM
ohh
Oct 9, 2021, 8:36 AM
Yes
Oct 9, 2021, 8:36 AM
so address is address(0)
Oct 9, 2021, 8:36 AM
Empty address is address (0)
Oct 9, 2021, 8:36 AM
Hmm thanks
one more doubt
Oct 9, 2021, 8:37 AM
πŸ‘πŸ‘
Sure
Oct 9, 2021, 8:37 AM
in ownable.sol
Oct 9, 2021, 8:37 AM
Yes
Oct 9, 2021, 8:37 AM
What's this address?
_owner
We have never assigned this to any hard coded address
Or niether equal to msg.sender
Oct 9, 2021, 8:38 AM
Now this is address (0)
The _owner is now msg.sender
Oct 9, 2021, 8:40 AM
wow thanks
I was stuck here from sometime
πŸ˜…
Yeah now clear
Oct 9, 2021, 8:41 AM
πŸ‘πŸ‘
Oct 9, 2021, 8:41 AM
We can use interface for abstract contract as well right?
Oct 9, 2021, 8:42 AM
Yes
Abstract contract is a library which inherits another library
πŸ‘
Oct 9, 2021, 10:12 AM
Again found old statement
so asked
Oct 9, 2021, 10:12 AM
πŸ˜‚
Alright the bot is up and running
Oct 9, 2021, 10:30 AM
why this error?
I am able to import all other files, but can't do with safemath and ownable
So, it's creating an instance of the kitty contract deployed?
Why do we need to declare interface of the contract we want to use functions of, inside the contract we are working on?
Let's say I'm working on contract A, and I want to access function abcd() of contract B
I have address of contract b - 0xb
as we can see on ether scan contract has interface functions available publicly for everyone
So can't we just access them from there?
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
@NeoMitashi Had some questions related to market cap
Actually I don't have good understanding of it
What happens when I suddenly double up the circulation supply? will market cap also double or market cap will remain same and price will go half down?
Oct 12, 2021, 7:41 AM
Exactly
Oct 12, 2021, 7:55 AM
Thanks
@grimreaper619
What will remain constant out of price, marketcap? as money invested in it same as earlier nothing flowing in it, but supply increasing
What does it mean that Call() function forward all the gas from the sender address to receiver address?
gas goes to miner not sender or receiver right?
Oct 12, 2021, 10:15 AM
Call is a lower level transaction
Oct 12, 2021, 10:15 AM
yeah this word also confusing
low level transactions and functions
What does it mean?
Oct 12, 2021, 10:16 AM
It means you can call other functions of contracts with hexadecimal values
Without an interface
Oct 12, 2021, 10:19 AM
Is there any read on low level functions? heard this word many times
Oct 12, 2021, 10:19 AM
Yes on solidity docs
Oct 12, 2021, 10:20 AM
solidity docs tells call(), delegatecall, staticcall are low level function, didn't find any resources on what it means
Oct 12, 2021, 10:21 AM
It's actually just that you can call functions of other contacts without any
Interface only with address
I don't remember were I've read it
Oct 12, 2021, 10:23 AM
So, where gas goes?
It goes to miner? or receiver of call?
Oct 12, 2021, 10:23 AM
Miner
Value goes to receiver
Oct 12, 2021, 10:26 AM
ok thanks
@NeoMitashi
Oct 12, 2021, 10:30 AM
πŸ‘
Oct 12, 2021, 10:32 AM
I am asking question bro
πŸ˜…
??
Oct 12, 2021, 10:37 AM
OhhπŸ˜‚
Oct 12, 2021, 10:37 AM
πŸ₯²
Oct 12, 2021, 10:37 AM
Idk bsc scan needs all the code that we put into the contract
Oct 12, 2021, 10:38 AM
@NeoMitashi Do u know this?
Oct 12, 2021, 10:39 AM
Marketcap will double and price of token will half
Oct 12, 2021, 10:40 AM
If price halves surely marketcap stays the same?
Oct 12, 2021, 10:46 AM
It depends on the cause
Oct 12, 2021, 10:46 AM
lmao how? if supply doubled, market cap doubled, then token price will be 4X
Oct 12, 2021, 10:47 AM
It depends actually
Oct 12, 2021, 10:47 AM
msg.sender is always type of address payable?
I am not getting this at all
Oct 12, 2021, 10:48 AM
Market cap is the amount of tokens people bought and are holding
Msd.sender is not payable by default
Oct 12, 2021, 10:48 AM
So how to make it?
Oct 12, 2021, 10:48 AM
Payable (msg.sender)
Oct 12, 2021, 10:49 AM
oh, I tried address payable(msg.sender)
Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead.
Anyone faced this error?
function() external payable {}
What's wrong with this fallback function?
Oct 12, 2021, 12:25 PM
It's receive () external payable {} in newer version of solidity
Oct 12, 2021, 12:25 PM
from which version?
Oct 12, 2021, 12:25 PM
Idk
Oct 12, 2021, 12:26 PM
function owner() public view virtual returns (address) {
return _owner;
}
This fucntion return _owner
Oct 12, 2021, 12:27 PM
Yea
Oct 12, 2021, 12:27 PM
address payable private _owner;
which is payable
address payable _owner = owner();
Oct 12, 2021, 12:28 PM
?
Oct 12, 2021, 12:28 PM
this is giving error - Type address is not implicitly convertible to expected type address payable.
Is this statement valid? as owner() returns a variable of address payable datatype
Oct 12, 2021, 12:29 PM
returns (payable address)
Oct 12, 2021, 12:29 PM
πŸ₯΅
I have updated a old version code I wrote to new one, you have helped a lot, learnt many things
Thanks bro
Oct 12, 2021, 12:31 PM
πŸ‘πŸ‘
Oct 12, 2021, 12:33 PM
It'll double ig
Price is calculated for 1 token
Then multiplied with supply
So if you double supply, it would be doubled as well
And you'll only get scammers for 50$ :)
Oct 12, 2021, 1:26 PM
I do not understand?
Oct 12, 2021, 1:27 PM
Good luck with 50$ smart contract probably you wouldn't neither be able to sell, or would be a copycat
Oct 12, 2021, 1:27 PM
hmm
I won't do much, I already prepared the contract, more or less, but I needed to add a feature, I have a problem with that.
That's why I said I have a $50 budget
I can give more, but I think this is the most worth it.
Oct 12, 2021, 1:29 PM
Good luck finding a devπŸ‘πŸ˜‚
Oct 12, 2021, 1:31 PM
When we reach 100k holders VRF will need to select the winner based on x amount held in the walllet
Oct 12, 2021, 1:32 PM
may be look on fiver
Oct 12, 2021, 1:32 PM
Why not 1M?
Oct 12, 2021, 1:36 PM
hi guys can anyone assist?πŸ™πŸΏπŸ™πŸΏπŸ™πŸΏ I tried to verify a smart contract on rinkeby testnet but I get an error like this: " Error! Unable to generate Contract ByteCode and ABI
Found the following ContractName(s) in source code : Address, Context, ERC165, ERC721, ERC721Enumerable, IERC165, IERC721, IERC721Enumerable, IERC721Metadata, IERC721Receiver, , Ownable, Strings
But we were unable to locate a matching bytecode (err_code_2)"
Oct 12, 2021, 1:37 PM
How are u doing this?
Use hardhat verification. It works well
Oct 12, 2021, 1:38 PM
i deployed through remix
Oct 12, 2021, 1:38 PM
Well if is a joke question haahaha otherwise 1M is way too far, token is new only 4 months old and we have around 15k holders atm so we thought 100k wouldn't be much
Oct 12, 2021, 1:38 PM
Oh than I can’t help. Sry
Oct 12, 2021, 1:38 PM
I think its to do with the bytecode? but i copied and pasted the correct bytecode
thanks anyway now need to set up truffle or hard hat
Oct 12, 2021, 1:39 PM
In both it’s pretty easy. Gl ;)
Oct 12, 2021, 1:40 PM
Or there was a pretty easy workaround. Iterablemapping
Oct 12, 2021, 1:40 PM
Yeah the point that i was looking was for a not expensive option as paying 6k fees to keep trustless and transparency. But since those are the only option i will have a think about of course each of the options has pro and cons..
thanks anyway
Oct 12, 2021, 1:45 PM
Yeah why not
Timestamp is of type uint256
That's what matters
Oct 12, 2021, 2:44 PM
ok
Oct 12, 2021, 2:51 PM
make sense, so market cap will remain same right?
Oct 12, 2021, 3:16 PM
No I said it'll double...
Only my guess. Never tried
Say you have 1000 token total supply and 100 token for liquidity with 100 BNB
So 1 token = 1 bnb
Market cap = 1000*1 bnb
So if 1000 becomes 2000
Logically it would be 2000 BNB right?
Oct 12, 2021, 3:21 PM
Yes, but the price change every transaction. Check the article on Medium about Uniswap pools
Oct 12, 2021, 3:51 PM
Well of course. People buy/sell it, pool changes
I gave example based on initial settings
Oct 12, 2021, 3:54 PM
So yes, the first time, you decide K as constant, the pool will play around that ratio and won't break from it ever.
Oct 12, 2021, 3:56 PM
Everything make sense now, price will be constant , otherwise project will double supply and give holders bonus as double price πŸ˜…
Marketcap is not a measure of how much funds project has in it right?
I don't understand the connection between liqudity and market cap
If liquidity is low then market cap moves faster, and if it's high then it moves slow and sometime liquidity is even more than market cap how?
Oct 12, 2021, 4:13 PM
liqudity is how much of asset is available on the markets (trading platforms, dexs, etc) market cap equates to = value of asset multipled by total number of assets
Oct 12, 2021, 4:14 PM
It's not a good measure to evaluate a asset, when if I put 1ETH liquidity then asset can move to millions of market cap If I put 100K in it
Oct 12, 2021, 4:15 PM
it measures how much all the tokens in circulation are worth.
Usually, marketcap is higher then the liquidity, but it counts less.
What matter, is the total $$ inside the liquidity pool. For example, GUH/Gravitoken forks, you should not care about marketcap but you should just care about liquidity funds.
Remember marketcap is total supply (- burn) * price of a single token.
Oct 12, 2021, 4:15 PM
so if there is 20m of meow token and that meow token worth 1 dollar but only 2m of them is on uniswap others are hold by whales as example. that mea liqudity is 2m on uniswap and market cap is 20m$
Oct 12, 2021, 4:15 PM
Market doesn't make any sense at all, only supply and price are real things, market cap is a larp.
whale bought that much supply from AMM?
And how liquidity is sometimes more than market cap?
Oct 12, 2021, 4:18 PM
i still need to understand how a marketcap/liq impact indicator can help in judging a coin, i've impelemented that kind of data in my scanner, but still don't know if it's useful or not πŸ˜†
Oct 12, 2021, 4:18 PM
That's not possible
Oct 12, 2021, 4:19 PM
it’s so important to understand that price doesn’t mean how valuable the asset it other than the scarcity. real life example is the $yfi token price higher than BTC that doesn’t mean that $yfi is valuable and people are buying it. on real life same goes to kuwaiti dinar worth more than 4 USD
Oct 12, 2021, 4:20 PM
Should I show you?
I understand that
Oct 12, 2021, 4:22 PM
yep, i don't remember any coin with more liquidity then mcap :o
Oct 12, 2021, 4:22 PM
creator can mint tokens without the need of β€œtrading” with others his hard earned eth
Oct 12, 2021, 4:22 PM
I got it
For example if 60% of the supply is in the pool then same amount of ETH is also in the pool, so if for the rest 40% market cap will always be lower
If 60% of the total supply is in the liq pool there must be an equal amount of ETH as well. So market cap then ends up being lower than the amount of liq
Oct 12, 2021, 4:40 PM
Yeah
Oct 12, 2021, 4:43 PM
I gave an example, can't find real example now, but it's very likely possible
Oct 12, 2021, 4:53 PM
do you know how marketcap is calculated?
Oct 12, 2021, 5:03 PM
Price * circulating supply
Oct 12, 2021, 5:20 PM
mc = price multiplied by supply

swap price = ratio of token0 and token1 in LP (minus lp fee / spread)
Oct 12, 2021, 5:20 PM
I know this.
Oct 12, 2021, 5:21 PM
word
Oct 12, 2021, 5:21 PM
I was trying to figure things like market cap can move too fast or too slow even If I put same money into it
So we can't major money putted into it just from market cap, like if market cap is 100M, then it doesn't mean project has 100M in it
Oct 12, 2021, 5:22 PM
thats from a large percentage of tokens outside of liquidity (i put $10 and 10 tokens in liq, and own 1 million token, then put $10 more in by buying it, and now market cap is doubled* (not really) with only 10 bucks)

mc $1m
then after purchase
mc $2m (basically)
Oct 12, 2021, 5:23 PM
Haha $10 made me millionaireπŸ˜…, Thanks got it
Oct 12, 2021, 5:26 PM
mc and TVL may are good metrics considering above
Oct 12, 2021, 5:27 PM
TVL is a really good measure for sure and Liquidity as well, But market cap I won't consider
Like $10 made it 2M from 1M haha
There is a high market cap proejct doing this
Oct 12, 2021, 5:29 PM
but by looking at the TVL u can see the MC is inaccurate (or accurate*)
Oct 12, 2021, 5:29 PM
They are controlling liquidity and sending it to 200-300X that's joke lol
Yeah, it's the point, thanks
I also check for TVL/MC while researching on projects
0x000000000000000000000000000000000000dEaD
What is this address?
I can use 0 address in place of this?
0 address, and this one
This is called dead address right?
Oct 12, 2021, 6:06 PM
Any graphic designers here? I need a logo made please
Oct 12, 2021, 7:02 PM
If you look at the usd value of the token and the liquidity is token/bnb then price goes up
If there are multiple pairs and not only bnb/token then... Arbitrage
Oct 12, 2021, 7:08 PM
Market cap would be used to check how much money is needed to enter the asset considering how much you put in. If you put in $1k into btc at $50k, what would the marketcap need to hit for it reach $100k for you to double your money. How much money needs to enter btc?
TVL is only useful for DeFi projects when considering farming or staking, not with normal ERC20 trading
Depending on your investment strategy, liquidity beats TVL and MC. Long term investing should be more focused on fundamental analysis
Oct 12, 2021, 7:18 PM
Thanks
Oct 12, 2021, 7:20 PM
Yw
But I am not saying I am pro pinksale / against dxsale, I personally dislike them both for their lack of transparency lol
Oct 12, 2021, 9:14 PM

Β© 2024 Draquery.com All rights reserved.