wasmlib/coreroot/
contract.rs

1// Copyright 2020 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4// (Re-)generated by schema tool
5// >>>> DO NOT CHANGE THIS FILE! <<<<
6// Change the schema definition file instead
7
8#![allow(dead_code)]
9
10use crate::*;
11use crate::coreroot::*;
12
13pub struct DeployContractCall<'a> {
14    pub func:   ScFunc<'a>,
15    pub params: MutableDeployContractParams,
16}
17
18pub struct GrantDeployPermissionCall<'a> {
19    pub func:   ScFunc<'a>,
20    pub params: MutableGrantDeployPermissionParams,
21}
22
23pub struct RequireDeployPermissionsCall<'a> {
24    pub func:   ScFunc<'a>,
25    pub params: MutableRequireDeployPermissionsParams,
26}
27
28pub struct RevokeDeployPermissionCall<'a> {
29    pub func:   ScFunc<'a>,
30    pub params: MutableRevokeDeployPermissionParams,
31}
32
33pub struct SubscribeBlockContextCall<'a> {
34    pub func:   ScFunc<'a>,
35    pub params: MutableSubscribeBlockContextParams,
36}
37
38pub struct FindContractCall<'a> {
39    pub func:    ScView<'a>,
40    pub params:  MutableFindContractParams,
41    pub results: ImmutableFindContractResults,
42}
43
44pub struct GetContractRecordsCall<'a> {
45    pub func:    ScView<'a>,
46    pub results: ImmutableGetContractRecordsResults,
47}
48
49pub struct ScFuncs {
50}
51
52impl ScFuncs {
53    pub fn deploy_contract(ctx: &impl ScFuncCallContext) -> DeployContractCall {
54        let mut f = DeployContractCall {
55            func:    ScFunc::new(ctx, HSC_NAME, HFUNC_DEPLOY_CONTRACT),
56            params:  MutableDeployContractParams { proxy: Proxy::nil() },
57        };
58        ScFunc::link_params(&mut f.params.proxy, &f.func);
59        f
60    }
61
62    pub fn grant_deploy_permission(ctx: &impl ScFuncCallContext) -> GrantDeployPermissionCall {
63        let mut f = GrantDeployPermissionCall {
64            func:    ScFunc::new(ctx, HSC_NAME, HFUNC_GRANT_DEPLOY_PERMISSION),
65            params:  MutableGrantDeployPermissionParams { proxy: Proxy::nil() },
66        };
67        ScFunc::link_params(&mut f.params.proxy, &f.func);
68        f
69    }
70
71    pub fn require_deploy_permissions(ctx: &impl ScFuncCallContext) -> RequireDeployPermissionsCall {
72        let mut f = RequireDeployPermissionsCall {
73            func:    ScFunc::new(ctx, HSC_NAME, HFUNC_REQUIRE_DEPLOY_PERMISSIONS),
74            params:  MutableRequireDeployPermissionsParams { proxy: Proxy::nil() },
75        };
76        ScFunc::link_params(&mut f.params.proxy, &f.func);
77        f
78    }
79
80    pub fn revoke_deploy_permission(ctx: &impl ScFuncCallContext) -> RevokeDeployPermissionCall {
81        let mut f = RevokeDeployPermissionCall {
82            func:    ScFunc::new(ctx, HSC_NAME, HFUNC_REVOKE_DEPLOY_PERMISSION),
83            params:  MutableRevokeDeployPermissionParams { proxy: Proxy::nil() },
84        };
85        ScFunc::link_params(&mut f.params.proxy, &f.func);
86        f
87    }
88
89    pub fn subscribe_block_context(ctx: &impl ScFuncCallContext) -> SubscribeBlockContextCall {
90        let mut f = SubscribeBlockContextCall {
91            func:    ScFunc::new(ctx, HSC_NAME, HFUNC_SUBSCRIBE_BLOCK_CONTEXT),
92            params:  MutableSubscribeBlockContextParams { proxy: Proxy::nil() },
93        };
94        ScFunc::link_params(&mut f.params.proxy, &f.func);
95        f
96    }
97
98    pub fn find_contract(ctx: &impl ScViewCallContext) -> FindContractCall {
99        let mut f = FindContractCall {
100            func:    ScView::new(ctx, HSC_NAME, HVIEW_FIND_CONTRACT),
101            params:  MutableFindContractParams { proxy: Proxy::nil() },
102            results: ImmutableFindContractResults { proxy: Proxy::nil() },
103        };
104        ScView::link_params(&mut f.params.proxy, &f.func);
105        ScView::link_results(&mut f.results.proxy, &f.func);
106        f
107    }
108
109    pub fn get_contract_records(ctx: &impl ScViewCallContext) -> GetContractRecordsCall {
110        let mut f = GetContractRecordsCall {
111            func:    ScView::new(ctx, HSC_NAME, HVIEW_GET_CONTRACT_RECORDS),
112            results: ImmutableGetContractRecordsResults { proxy: Proxy::nil() },
113        };
114        ScView::link_results(&mut f.results.proxy, &f.func);
115        f
116    }
117}