7. Interacting with contracts
interface FungibleToken:
global Ticker -> String -- this is similar to schema definition; in fact
-- it is a requirement that the schema must provide
-- a global state of the String type and link it to
-- the "Ticker" name
global Name -> String
owned Inflation :: Zk64 -- pretty much the same applies to assigned state
owned Asset :: Zk64
op Issue :: Inflation -> [Asset]?, Inflation? -- and operations
op Transfer :: {Asset} -> [Asset]
-- Specific schema state may use different naming, for instance because a
-- schema can define multiple assets with different names; in that case we
-- will have multiple interface implementations referencing different state.
implement FungibleToken for DecentralizedIdentity
global Ticker := IOYTicker -- this creates a _binding_ of the state defined
-- in the schema (*IOYTicker* in this case) to
-- the interface
global Name := IOYName
owned Inflation := IOYIssue
owned Asset := IOYTokens
op Issue := Promise
op Transfer -- here we skip `:=` part since the interface operation name
-- matches the name used in the schema. In such cases we can
-- also skip the declaration at wholeLast updated
Was this helpful?