1

So here's my problem:

My UNI drop was sent to and outdated instadapp mcd vault at contract address: 0xc653461d3D4c6AD53c16ebE16fa07f820e115139 which i am the owner of at address: 0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb can someone help me or tell me how i can transfer the uni to my wallet or anything i can do to get it in my possession?

please and thank you :)

EDIT:

sorry let me add a bit more info.

https://old.instadapp.io/makermcd/?vault=0

back in the good ol days right before the pandemic (february) instadapp and the maker vault i set up was qualified to receive 400 UNI from the drop a few months back. So I claimed the UNI via entering the address of the mcd vault smart contract address (0xc653461d3D4c6AD53c16ebE16fa07f820e115139) into the uniswap website and hit claim, which was all i could do. I was hoping it would show up on the instadapp and the balance would be seen and available in the maker vault. however it is not. So I have an ETH address on Metamask (0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb) which is the owner of the smart contract that contains the UNI. however i can't figure out how to get to it.

I will gladly compensate a portion of the UNI to whoever can help me figure this out and get possession of it, considering it's worth absolutely nothing in the state it's in now.

Hopefully that helps understand the situation a bit more and hopefully someone can help me find a solution to this.

LAST EDIT:

where should i post the code that you responded with? using npm?

4
  • I believe that you should call function execute and pass to it the following parameters: Nov 21 '20 at 20:15
  • 1. '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984' Nov 21 '20 at 20:15
  • 2. '0xa9059cbb00000000000000000000000034a2860bbba761ae27005799b02d3dbd8b4b5feb000000000000000000000000000000000000000000000015af1d78b58c400000' Nov 21 '20 at 20:16
  • For the 3rd and 4th parameter I guess you can pass whatever you want because they don't really take a part in the actual operation (only emitted as part of an event). Nov 21 '20 at 20:18
2

Here is what I think that you should do (using web3.js v1.2):

const Web3 = require("web3");

// enter your node address and private key below, for example:
const NODE_ADDRESS = "https://mainnet.infura.io/v3/12345678123456781234567812345678";
const PRIVATE_KEY  = "0x1234567812345678123456781234567812345678123456781234567812345678";

const USER_WALLET_CONTRACT_ADDR = "0xc653461d3D4c6AD53c16ebE16fa07f820e115139";
const UNI_TOKEN_CONTRACT_ADDR   = "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984";

const USER_WALLET_CONTRACT_ABI = [
    {
        "constant":false,
        "inputs":[{"name":"_target","type":"address"},{"name":"_data","type":"bytes"},{"name":"_src","type":"uint256"},{"name":"_session","type":"uint256"}],
        "name":"execute",
        "outputs":[{"name":"response","type":"bytes"}],
        "payable":true,
        "stateMutability":"payable",
        "type":"function"
    }
];

const UNI_TOKEN_CONTRACT_ABI = [
    {
        "constant":true,
        "inputs":[{"internalType":"address","name":"account","type":"address"}],
        "name":"balanceOf",
        "outputs":[{"internalType":"uint256","name":"","type":"uint256"}],
        "payable":false,
        "stateMutability":"view",
        "type":"function"
    },
    {
        "constant":false,
        "inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"rawAmount","type":"uint256"}],
        "name":"transfer",
        "outputs":[{"internalType":"bool","name":"","type":"bool"}],
        "payable":false,
        "stateMutability":"nonpayable",
        "type":"function"
    }
];

async function scan(message) {
    process.stdout.write(message);
    return await new Promise((resolve, reject) => {
        process.stdin.resume();
        process.stdin.once("data", (data) => {
            process.stdin.pause();
            resolve(data.toString().trim());
        });
    });
}

async function getGasPrice(web3) {
    while (true) {
        const nodeGasPrice = await web3.eth.getGasPrice();
        const userGasPrice = await scan(`Enter gas-price or leave empty to use ${nodeGasPrice}: `);
        if (/^\d+$/.test(userGasPrice))
            return userGasPrice;
        if (userGasPrice === "")
            return nodeGasPrice;
        console.log("Illegal gas-price");
    }
}

async function getTransactionReceipt(web3) {
    while (true) {
        const hash = await scan("Enter transaction-hash or leave empty to retry: ");
        if (/^0x([0-9A-Fa-f]{64})$/.test(hash)) {
            const receipt = await web3.eth.getTransactionReceipt(hash);
            if (receipt)
                return receipt;
            console.log("Invalid transaction-hash");
        }
        else if (hash) {
            console.log("Illegal transaction-hash");
        }
        else {
            return null;
        }
    }
}

async function send(web3, account, transaction, value = 0) {
    while (true) {
        try {
            const options = {
                data: transaction.encodeABI(),
                gas: await transaction.estimateGas({from: account.address, value: value}),
                gasPrice: await getGasPrice(web3)
            };
            const signed = await web3.eth.accounts.signTransaction(options, account.privateKey);
            const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
            return receipt;
        }
        catch (error) {
            console.log(error.message);
            const receipt = await getTransactionReceipt(web3);
            if (receipt)
                return receipt;
        }
    }
}

async function run() {
    const web3 = new Web3(NODE_ADDRESS);
    const account = web3.eth.accounts.privateKeyToAccount(PRIVATE_KEY);

    const userWalletContract = new web3.eth.Contract(USER_WALLET_CONTRACT_ABI, USER_WALLET_CONTRACT_ADDR);
    const uniTokenContract = new web3.eth.Contract(UNI_TOKEN_CONTRACT_ABI, UNI_TOKEN_CONTRACT_ADDR);

    const balance = await uniTokenContract.methods.balanceOf(account.address).call();
    const data = uniTokenContract.methods.transfer(account.address, balance).encodeABI();
    const transaction = userWalletContract.methods.execute(uniTokenContract._address, data, 0, 0);
    const receipt = await send(web3, account, transaction);

    console.log(JSON.stringify(receipt, null, 4));

    if (web3.currentProvider.disconnect)
        web3.currentProvider.disconnect();
}

run();
7
  • I think he wants to claim UNI tokens, that should be calling the token distributtor with the right parameters etherscan.io/address/…
    – Ismael
    Nov 23 '20 at 5:31
  • @Ismael: Possibly, but then there's missing information in the question (for example, the fact that he/she holds the Merkle proof). Thinking about it, you are probably correct, since he/she does mention that this amount of tokens was granted via airdrop, so a Merkle proof would indeed be required here (assuming that Uniswap have used this concept when they airdropped those $600M worth of UNI tokens). Nov 23 '20 at 6:01
  • @Ismael: So what do you think? Is this even relevant to the question at hand? Nov 23 '20 at 11:25
  • 1
    My mistake, the token are already in the contract, so to move them to another address the code posted should be good.
    – Ismael
    Nov 23 '20 at 20:35
  • 1
    @Ismael: Thanks. Feel free to edit the answer, not sure I have the capacity at the moment. If you think that it is fundamentally wrong or misleading, then I will delete it. Thank you. Nov 24 '20 at 21:04
0

I finally got it thank God, after asking in Telegram channel for over a month it was as simple as going to https://old.instadapp.io/exit from your web3 connected wallet and viola. I got my tokens back. Worth about $4k at the time. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.