// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package gethwrappers_zksync

import (
	"context"
	"crypto/rand"
	"fmt"
	"github.com/ethereum/go-ethereum/accounts/abi/bind"
	"github.com/ethereum/go-ethereum/common"
	"github.com/zksync-sdk/zksync2-go/accounts"
	"github.com/zksync-sdk/zksync2-go/clients"
	"github.com/zksync-sdk/zksync2-go/types"
	"github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers"
)

func DeployCallProxyZk(deployOpts *accounts.TransactOpts, client *clients.Client, wallet *accounts.Wallet, backend bind.ContractBackend, args ...interface{}) (common.Address, *types.Receipt, *gethwrappers.CallProxy, error) {
	var calldata []byte
	if len(args) > 0 {
		abi, err := gethwrappers.CallProxyMetaData.GetAbi()
		if err != nil {
			return common.Address{}, nil, nil, err
		}
		calldata, err = abi.Pack("", args...)
		if err != nil {
			return common.Address{}, nil, nil, err
		}
	}

	salt := make([]byte, 32)
	n, err := rand.Read(salt)
	if err != nil {
		return common.Address{}, nil, nil, err
	}
	if n != len(salt) {
		return common.Address{}, nil, nil, fmt.Errorf("failed to read random bytes: expected %d, got %d", len(salt), n)
	}

	txHash, err := wallet.Deploy(deployOpts, accounts.Create2Transaction{
		Bytecode: CallProxyZkBytecode,
		Calldata: calldata,
		Salt:     salt,
	})
	if err != nil {
		return common.Address{}, nil, nil, err
	}

	receipt, err := client.WaitMined(context.Background(), txHash)
	if err != nil {
		return common.Address{}, nil, nil, err
	}

	address := receipt.ContractAddress
	contract, err := gethwrappers.NewCallProxy(address, backend)
	if err != nil {
		return common.Address{}, nil, nil, err
	}

	return address, receipt, contract, nil
}

var CallProxyZkBytecode = common.Hex2Bytes("00020000000000020001000000000002000000000301001900000060033002700000003508300197000100000081035500000001022001900000004e0000c13d0000008002000039000000400020043f0000001f0380018f00000005028002720000000502200210000000140000613d000000000401034f0000000005000019000000004604043c0000000005650436000000000625004b000000100000c13d000100000008001d000000000403004b000000220000613d0000000303300210000000000402043300000000043401cf000000000434022f000000000121034f000000000101043b0000010003300089000000000131022f00000000013101cf000000000141019f00000000001204350000003b0100004100000000001004390000000001000412000000040010044300000024000004430000000001000414000000350210009c0000003501008041000000c0011002100000003c011001c7000080050200003900cf00ca0000040f0000000102200190000000900000613d000000000401043b0000000001000414000000040240008c000000910000c13d000000010200036700000000030000310000001f0430018f00000005013002720000000501100210000000400000613d000000000502034f0000000006000019000000005705043c0000000006760436000000000716004b0000003c0000c13d000000000504004b000000be0000613d0000000304400210000000000501043300000000054501cf000000000545022f000000000212034f000000000202043b0000010004400089000000000242022f00000000024201cf000000000252019f0000000000210435000000be0000013d0000000002000416000000000202004b0000008e0000c13d0000001f028000390000003602200197000000a002200039000000400020043f0000001f0280018f00000005038002720000000503300210000000600000613d000000a004000039000000a005300039000000000601034f000000006706043c0000000004740436000000000754004b0000005c0000c13d000000000402004b0000006e0000613d000000000131034f0000000302200210000000a003300039000000000403043300000000042401cf000000000424022f000000000101043b0000010002200089000000000121022f00000000012101cf000000000141019f0000000000130435000000200180008c0000008e0000413d000000a00100043d000000370210009c0000008e0000213d000000800010043f000000400200043d0000000000120435000000350120009c000000350200804100000040012002100000000002000414000000350320009c0000003502008041000000c002200210000000000112019f00000038011001c70000800d020000390000000103000039000000390400004100cf00c50000040f00000001012001900000008e0000613d000000800100043d0000014000000443000001600010044300000020010000390000010000100443000000010100003900000120001004430000003a01000041000000d00001042e0000000001000019000000d100010430000000000001042f000000000300041600000001020000290000006002200210000000350510009c0000003501008041000000c001100210000000000121019f000000000203004b0000009c0000c13d00000000020400190000009f0000013d0000003d011001c70000800902000039000000000500001900cf00c50000040f0001000000010355000000000301001900000060033002700000001f0530018f000000350030019d000000350330019700000005043002720000000504400210000000af0000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000847004b000000ab0000c13d000000000605004b000000bc0000613d0000000305500210000000000604043300000000065601cf000000000656022f000000000141034f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000000101200190000000c20000613d000000350130009c00000035030080410000006001300210000000d00001042e0000006001300210000000d100010430000000000001042f000000c8002104210000000102000039000000000001042d0000000002000019000000000001042d000000cd002104230000000102000039000000000001042d0000000002000019000000000001042d000000cf00000432000000d00001042e000000d1000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000ffffffffffffffffffffffffffffffffffffffff02000000000000000000000000000000000000200000000000000000000000003bfb4bbf112628248058745a3c57e35b13369386e474b8e56c552f3063a4a1960000000200000000000000000000000000000080000001000000000000000000310ab089e4439a4c15d089f94afb7896ff553aecb10793d0ab882de59d99a32e02000002000000000000000000000000000000440000000000000000000000000200000000000000000000000000000000000000000000000000000000000000d035e4b626d0c4b01889d7c3520441a3fc495242ce54c5d520829ea176fd524e")
