For example I have a contract that has the following bytecode 0x433d52593df3
(contract that returns the current block number if called). How could I call such a contract?
1 Answer
Yes, you can; send a standard transaction to it.
Solidity compiles functions/methods into a custom switch/case
pattern applied to the calldata
sent to the smart contract with the tx. Following that rule is not mandatory, just a best practice.
If you want to experiment your functionless smart contract using Solidity/Yul, you can start with something like this:
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract ReturnBlockNumber {
fallback() external {
assembly {
mstore(0x0, number())
return(0x0, 32)
}
}
}
You can also use Remix to call that contract, check the Low Level Interaction panel.
Side note about 0x433d52593df3
: really clever use of 3d
instead of 6000
;)
0x433d52593df3
come about, or from where?