Closed LemonNekoGH closed 1 year ago
No that is incorrect, they can change Blockchain state, and they can get Blockchain state. There is a contract with a struct
pub contract Example {
priv let name: String
pub struct ExampleStruct {
pub fun getName(): String {
return Example.name // return blockchain state 🤯
}
pub fun setName(_ n: String) {
Example.name = n // change blockchain state 🤯
}
}
init() {
self.name = ""
}
}
But how do we position the instance of struct/resource? We can only construct the type and invoke function...
Methods of nested struct or resource is for query script. Standalone call is unuseful because it will not chang Blockchain's state, should not generate go methods code for them.