Ethereum: Error when attempting to send SepoliaETH between two accounts in remix via smart contract with specific conditions: Cause of error –>undefined gas

I can control it through the process of creating a Remix intelligent contract, which charts the payment transaction between two ETH Sepolia accounts in different metamask wallets.

Previous requirements:

  • Remix is ​​installed in the Ethereum block chain.

  • You have a Sepolia ET wallet and Metamämaka wallet.

  • You have basic information on developing smart contracts in remix.

Step 1: Create a new remix contract **

Go to Remix to Settings '> New Agreement’ (or press Ctrl + Shift + N Windows/Linux OCmd + Shift + N Macos) and create a new agreement. Name something “sepoliapaymentmap”.

Step 2: Specify the interface of the transaction

Add the interface to the Remix agreement to determine payment transactions. You must specify two functions:

  • ‘Reception’: This feature receives a payment transaction from Sepolia ETH and gives it to a new transaction in another Metamash wallet.

  • ‘Memory’: This function is used to cancel the specified payment transaction.

Here’s a sample:

`Severity

PaytraSaction Interface interface {

(Sender, recipient, number): [Bytes4; 32]

}

Struct SepoliaPaymentmapContext {

Sender: Address;

Recipient: Address;

Quantity: Uint64;

}

Pragman solidity ^0.8.0;

The map agreement for the sepolia elasticity is PaytraSactioninterface {

Determination (address => mapping (UINT64 => address)) Private _mappedtraSactions;

Receipt Function (Sender Address, Payable to the Recipient, Number UINT64) Public {

// Specify the transaction

(_Mappedtransactions [sender] [quantity], _) = _mappedtransactions [sender] .Insert (recipient, quantity);

}

Memory function (Uint64 Singing) Public {

// Cancel the specified payment transaction

Remove _Mapttransactions [sender] [quantity];

}

}

Step 3: Specify the logic of the contract

Ethereum: Error when attempting to send SepoliaETH between two accounts in remix via smart contract with specific conditions: Cause of error -->undefined gas<br />

In the Remix Agreement, you need to determine the logic to map and cancel the transactions. You can do it with a loop or recursion.

Here's a sample:

Severity

Pragman solidity ^0.8.0;

SePoyPayment map {contract {

// Specify the interface for payment transaction

PaymentransactionInderface Public Interface;

// platform mapped transactions of storage matrix

Determination (address => mapping (UINT64 => address)) Private _mappedtraSactions;

// builder

Function () internal payment {

_Mappedtrasactions [msg.sender] [0] = msg.seender;

}

// Function to determine the transaction

Receipt Function (Sender Address to the Payable Recipient, Number UINT64) Public {

// Make sure if there is an assignment for the sender and the number

Require (_mapptransactions [sender] [quantity]! = Address (0), "there is no task");

// Specify the transaction

_Mappedtransactions [sender] [quantity] = recipient;

// Set the payment transaction specified in the storage matrix

Interface._mapptransactions [sender] [quantity] = recipient;

}

// Function to restore the specified payment transaction

Memory function (Uint64 Singing) Public {

// Make sure if there is an assignment for the sender and the number

Require (_mapptransactions [sender] [quantity]! = Address (0), "there is no task");

// Cancel the specified payment transaction

Remove _Mapttransactions [sender] [quantity];

}

}

Step 4: Turn and implement an agreement

Compare the remix contract with the following command:

Severity

Remix -P -Interface PayletraldraSinterface -Contract SepoliaPaymentmap

`

Complete your contract with the Ethereum block chain.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top