You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon creation, each account will be initialized with a set amount of compute tokens (this number can be set by anyone with the appropriate access).
32
+
33
+
# Contract Deployment:
34
+
To deploy a contract, use the following format. The path to the contract must begin with `*state*`. Contract definitions must be wrapped in a begin statement. Variables must be defined first, as a hash table called vars, with variables initialized to whatever values are necessary. #f can be used as an init value. There is no restriction on function names. When referring to variables in a function definition, refer to them as elements of the hash table, as shown in the below code. Functions can use the caller's username (shown in example ):
If a function needs to make a cross-contract call, it can be done as follows, using the cross-call subfunction. In the example below, cross-call is called with three parameters: the path to the contract being called, the index (default #f), and the name of the method in the contract being called. In the example below, the vote-similar method calls the vote2 method, from the contract above.
Here is an example where a user calls the vote2 method defined above.
72
+
```
73
+
(*local* "password"
74
+
(contract-call "user1" "pass1"
75
+
(*state* contracts bill2)
76
+
#f
77
+
(vote2)))
78
+
```
79
+
80
+
# Compute Tokens:
81
+
Deploying and calling contracts require an account because each operation costs an amount of tokens proportional to the number of cpu cycles consumed by the operation. Tokens will be replenished to the starting amount when the replenishment period has passed (the replenishment period can be set by anyone with the appropriate access).
0 commit comments