Exemple #1
0
        public async Task <ACI> GenerateACIAsync(string contractCode, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            await CheckCompilerBackendAsync();

            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            Contract body = new Contract {
                Code = contractCode, Options = new CompileOpts {
                    Backend = opts.Value
                }
            };

            return(await _compilerClient.GenerateACIAsync(body, token));
        }
Exemple #2
0
        public Task ValidateByteCodeAsync(string source, string bytecode, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            ValidateByteCodeInput input = new ValidateByteCodeInput();

            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            input.Options = new CompileOpts()
            {
                Backend = opts.Value
            };
            input.Bytecode = bytecode;
            input.Source   = source;
            return(_compilerClient.ValidateByteCodeAsync(input, token));
        }
Exemple #3
0
 public static ByteCode Compile(this FlatClient client, string contractCode, string srcFile, object fileSystem, CompileOptsBackend?opts = null) => client.CompileAsync(contractCode, srcFile, fileSystem, opts).RunAndUnwrap();
Exemple #4
0
 public static ACI GenerateACI(this FlatClient client, string contractCode, CompileOptsBackend?opts = null) => client.GenerateACIAsync(contractCode, opts).RunAndUnwrap();
Exemple #5
0
 public static void ValidateByteCode(this FlatClient client, string source, string bytecode, CompileOptsBackend?opts = null) => client.ValidateByteCodeAsync(source, bytecode, opts).RunAndUnwrap();
Exemple #6
0
 public static DecodedCalldata DecodeCallDataWithSource(this FlatClient client, string calldata, string function, string sourceCode, CompileOptsBackend?opts    = null) => client.DecodeCallDataWithSourceAsync(calldata, sourceCode, function, opts).RunAndUnwrap();
Exemple #7
0
 public static JToken DecodeCallResult(this FlatClient client, string sourceCode, string function, string callResult, string callValue, CompileOptsBackend?opts = null) => client.DecodeCallResultAsync(sourceCode, function, callResult, callValue, opts).RunAndUnwrap();
Exemple #8
0
        public async Task <ByteCode> CompileAsync(string contractCode, string srcFile, object fileSystem, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            await CheckCompilerBackendAsync();

            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            Contract body = new Contract {
                Code = contractCode, Options = new CompileOpts()
                {
                    Backend = opts.Value
                }
            };

            if (!string.IsNullOrEmpty(srcFile))
            {
                body.Options.SrcFile = srcFile;
            }
            if (fileSystem != null)
            {
                body.Options.FileSystem = fileSystem;
            }
            return(await _compilerClient.CompileContractAsync(body, token));
        }
Exemple #9
0
        public async Task <DecodedCalldata> DecodeCallDataWithSourceAsync(string calldata, string sourceCode, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            await CheckCompilerBackendAsync();

            DecodeCalldataSource body = new DecodeCalldataSource();

            body.CallData = calldata;
            body.Source   = sourceCode;
            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            body.Options = new CompileOpts()
            {
                Backend = opts.Value
            };
            return(await _compilerClient.DecodeCalldataSourceAsync(body, token));
        }
Exemple #10
0
        public async Task <JToken> DecodeCallResultAsync(string sourceCode, string function, string callResult, string callValue, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            await CheckCompilerBackendAsync();

            SophiaCallResultInput body = new SophiaCallResultInput();

            body.Source   = sourceCode;
            body.Function = function;
            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            body.Options = new CompileOpts()
            {
                Backend = opts.Value
            };
            body.CallResult = callResult;
            body.CallValue  = callValue;
            return(await _compilerClient.DecodeCallResultFixedAsync(body, token));
        }
Exemple #11
0
        public async Task <Calldata> EncodeCallDataAsync(string sourceCode, string function, List <string> arguments, CompileOptsBackend?opts = null, CancellationToken token = default(CancellationToken))
        {
            await CheckCompilerBackendAsync();

            FunctionCallInput body = new FunctionCallInput();

            body.Source   = sourceCode;
            body.Function = function;
            if (opts == null)
            {
                opts = _backend == "fate" ? CompileOptsBackend.Fate : CompileOptsBackend.Aevm;
            }
            body.Options = new CompileOpts()
            {
                Backend = opts.Value
            };
            if (arguments != null)
            {
                foreach (string arg in arguments)
                {
                    body.Arguments.Add(arg);
                }
            }

            return(await _compilerClient.EncodeCalldataAsync(body, token));
        }