// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract t1{
   
    mapping(address => uint256[])  AllSpecialNFT;
    uint [] temp;
    function addNewVal(uint _tokenId) public {
        // AllSpecialNFT[msg.sender].push(_tokenId);
        temp = AllSpecialNFT[msg.sender];
        temp.push(_tokenId);
        AllSpecialNFT[msg.sender] = temp;
        uint [] memory ax;
        temp = ax;
    }

    function findSize() public view returns(uint){
        return AllSpecialNFT[msg.sender].length;
    }
   
}

pragma solidity >=0.4.22 <0.9.0;
import './t1.sol';

contract t2{
    t1 _t1;
    constructor(t1 t1_){
        _t1 = t1_;
    }
    function callandAdd(uint _tokenId) public{
        _t1.addNewVal(_tokenId);
    }
}



Guys in this i am trying to update the mapping from another contract but i am not able to do it. Is there any way? Or if its possible please point out the mistake.

Jan 20, 2023, 4:07 PM
@karola96 can you help?
Jan 20, 2023, 5:27 PM
If i read solidity 0.4, no
Why would you even code on that version
Jan 20, 2023, 5:32 PM
i am using 0.8
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract t1{
   
    mapping(address => uint256[])  AllSpecialNFT;
    uint [] temp;
    function addNewVal(uint _tokenId) public {
        // AllSpecialNFT[msg.sender].push(_tokenId);
        temp = AllSpecialNFT[msg.sender];
        temp.push(_tokenId);
        AllSpecialNFT[msg.sender] = temp;
        uint [] memory ax;
        temp = ax;
    }

    function findSize() public view returns(uint){
        return AllSpecialNFT[msg.sender].length;
    }
   
}

pragma solidity ^0.8.0;
import './t1.sol';

contract t2{
    t1 _t1;
    constructor(t1 t1_){
        _t1 = t1_;
    }
    function callandAdd(uint _tokenId) public{
        _t1.addNewVal(_tokenId);
    }
}



Guys in this i am trying to update the mapping from another contract but i am not able to do it. Is there any way? Or if its possible please point out the mistake.
Jan 21, 2023, 4:35 AM
Debug it, line by line
Jan 21, 2023, 4:37 AM
btw, do you know a debugger for solidity to line by line execution?
Jan 21, 2023, 4:41 AM
console.log top tier debugger
Jan 21, 2023, 4:42 AM
thats a paid sub aint it?
Jan 21, 2023, 4:43 AM
yes 42$/month
Jan 21, 2023, 4:43 AM
@ElprofesorH777
Jan 21, 2023, 11:15 AM
as we wrote the code
that's why testing is fundamental
but yeah... i have the same question on hacks like bridges, or anything > 100m$$
Jan 21, 2023, 1:15 PM
yes, it can't be your fault
everyone does testing but I saw many big hacks
Jan 21, 2023, 1:17 PM
yep, that's a nice question actually
Jan 21, 2023, 1:17 PM
. A lot of times clients will go for the cheapest option and disrespect you saying stuff like “well I can find someone to do it for $20”
And that $20 guy is just some guy that wants quick money and gives something that barely works and isn’t tested
I’m sure this happens on a bigger scale when projects don’t want to pay $50k for an audit they go for some random dude and then get hacked/exploited
Jan 21, 2023, 1:33 PM
it will if you add tokens:USDT for example
if you have LP tokens, it's like having tokens:BNB
Jan 21, 2023, 2:01 PM

© 2024 Draquery.com All rights reserved.