169 похожих чатов

Hi guys! How to clone new contract from this on

deposit and retrieve new contract address?

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

contract ConcatName {

bytes public name;

constructor(bytes memory _name) {
name = _name;
}

function Deposit() external payable returns(address){
return address(new ConcatName(abi.encodePacked(name, abi.encodePacked("+"))));
}
}

I want to get something

contract1.name = "hello"
contract1.deposite() = contract2 //contract2.name = "hello+"
contract1.deposite() = contract3 //contract3.name = "hello+"
contract2.deposite() = contract4 //contract4.name = "hello++"
contract4.deposite() = contract5 //contract5.name = "hello+++"
contract3.deposite() = contract6 //contract6.name = "hello++"

6 ответов

4 просмотра

two possibilities: 1/ using assembly or yulp (tough) 2/ easy way: using a factory

Co.In-🇺🇦 🔜 Автор вопроса

Sorry. Contract deployed. But after call deposit() state reverted with error

You need to have an address parameter in the constructor that takes the address of the deployed contract factory. Your current code assumes that the contract factory is deployed at msg.sender but that's just your deployer wallet address

Co.In 🇺🇦 🔜
screenshot Sorry. Contract deployed. But after call deposit()...

1/ you have to deploy the ConcatNameFactory, not the ConcatName 2/ I miss the entrypoint to enter in the loop, so in the factory’s constructor, deploy the very first ConcatContract

Похожие вопросы

Обсуждают сегодня

я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
короче сгенерила мне эта штука код на ассемблере: struc string val { common local .value dq .value .value: if ~val eq db val end if db 0 } fo...
Vi Chapmann Chapmann
12
Всем привет! Массив вводится с клавиатуры, кол-во элементов неизвестно, поэтому я указал arr db 100 dup(?) С нахождением максимума проблем нет, а вот минимум почему-то всегд...
En Vind Av Sorg
11
Помогите, пожалуйста, делаю программу для для подсчёта корней квадратного уравнения, знаю, что есть куча недочётов, недоработок, но основная проблема в том, что почему-то при ...
NYC
13
#include <stdio.h> int main(void) { int n; scanf("%d", &n); int digits1[n] = {0}; int digits2[n] = {0}; я не могу таким образом заранее массив нулями заполнить?
Linus
12
в сях есть множество как в питоне? для удаление дубликатов
Linus
25
читать файл максимально быстро? странный вопрос))
zamtmn
53
я про форму записи. смысл указывать что 8 байтный регистр 8 байт?
Aiwan \ (•◡•) / _bot
10
Вроде бы вопрос уже заезжанный, но тем не менее У меня есть функция menu() которая выводит набор возможных действий, а затем спрашивает у пользователя что он хотел бы сделать....
David Golovatin
4
а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
Карта сайта