简体   繁体   English

Solidity 转账资金正在重定向到另一个地址

[英]Solidity transfer funds is redirecting to another address

I am trying to send funds in solidity using the below code我正在尝试使用以下代码稳定地发送资金

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

contract SendEther
{
    function sendAmount() payable public
    {
        address _to = 0x90E3EC58Eb437204ad071339d6CE97740e7eadd0;
        payable(_to).transfer(msg.value);
    }
}

However, I am getting a entirely different address on metamask wallet enter image description here但是,我在 metamask 钱包上得到了一个完全不同的地址,在此处输入图像描述

The 0xab29... address that you see in MetaMask is the contract address.您在 MetaMask 中看到的0xab29...地址就是合约地址。

In order to execute the sendAmount() function, effectively redirecting the funds to the 0x90E3... address, you need to send a transaction to the contract address (with the corresponding value of the data field of the transaction, representing the sendAmount() function signature).为了执行sendAmount() function,有效地将资金重定向到0x90E3...地址,需要向合约地址发送一笔交易(与交易的data字段对应的值,代表sendAmount() function 签名)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM