0

I am working on WETH

pragma solidity ^0.8.5; import "./Token.sol";

contract WETH {

    function transferFrom(address recipient, uint256 amount) external {
       Token token = Token(0xc778417E063141139Fce010982780140Aa0cD5Ab);
       token.transferFrom(msg.sender, recipient, amount );

   }
}

0xc778417E063141139Fce010982780140Aa0cD5Ab is contract address from WETH according to https://docs.uniswap.org/protocol/reference/deployments

I want to create a functionality where I can create a opensea like marketplace and accept WETH from registering user on platform and give platform the permission to withdraw balance from User's account (Bidding like functionality) Can someone please guide me through it? I am not looking to convert ETH to WETH on my platform. I am expecting user to send WETH and have it in their account.

How can I get it implemented. Any repository or guidance will be greatly appreciated.

1 Answer 1

1

WETH is an ERC20 token which can be simply transferred between accounts. Technically, all ERC20 tokens are accounted within the token contract. Therefore your contract needs to just simply calling the respective token contracts and use their transferFrom or transfer function to move user funds.

So in your contract you need to implement the ERC20 interface and use its functions to implement your logic. BTW I collected you some resources that can be helpful. The Opensea contracts are public, so I would check it after learning a bit about the ERC20 concept. Especially about allowance and approval.

However, dealing with NFTs will require knowledge about NFT token standards.

Understand the ERC-20 token smart contract

Approve/Allowed function explained

Opensea Github

Transfer ERC20 token from your Solidity smart contract

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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