Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
The goal is to implement a to-bytes and from-bytes converter for structs to be able to pass them from contract to contract in a form of bytes

Given the following set of contracts, the goal is to implement a to-bytes and from-bytes converter for structs to be able to pass them from contract to contract in the form of bytes. Please assume that Storage and Controller contracts have different addresses on the network. StructDefiner is never deployed on its own and is used as a part of Storage or Controller.

     // SPDX-License-Identifier: MIT
    
    pragma solidity ^0.8.12;
    
    contract StructDefiner {
        struct MyStruct {
            uint256 someField;
            address someAddress;
            uint128 someOtherfield;
            uint128 oneMoreField;
        }
    }
    
    contract  Storage {
        StructDefiner.MyStruct[] internal structs;
    
        function getStructByIdx(uint256 idx) external view returns (bytes memory) {
            assembly {
                
                //Your code
    
            }
        }
    }
    
    contract Controller {
        Storage internal storag;
        constructor(address _storage) {
            storag = Storage(_storage);
        }
    
        function getStruct(uint256 idx) public view returns (StructDefiner.MyStruct memory myStruct) {
            bytes memory _myStruct = storag.getStructByIdx(idx);
            assembly {
                //your code
            }
        }
    }
    
    

I am a beginner in solidity and assembly language please give me some idea how I can solve this problem.
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda