Skip to content

Commit

Permalink
fix(initialize state): update initialize state handler to use owner f…
Browse files Browse the repository at this point in the history
…rom encoded state
  • Loading branch information
atticusofsparta committed Jun 25, 2024
1 parent 486bf59 commit ed04907
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/common/initialize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function initialize.initializeANTState(state)
local records = encoded.records
local name = encoded.name
local ticker = encoded.ticker
local owner = encoded.owner
assert(type(name) == "string", "name must be a string")
assert(type(ticker) == "string", "ticker must be a string")
assert(type(balances) == "table", "balances must be a table")
Expand All @@ -17,6 +18,7 @@ function initialize.initializeANTState(state)
end
assert(type(controllers) == "table", "controllers must be a table")
assert(type(records) == "table", "records must be a table")
assert(type(owner) == "string", "owner must be a string")
for k, v in pairs(records) do
utils.validateUndername(k)
assert(type(v) == "table", "records values must be tables")
Expand All @@ -30,13 +32,16 @@ function initialize.initializeANTState(state)
Controllers = controllers
Records = records
Initialized = true
Owner = owner

return json.encode({
name = Name,
ticker = Ticker,
balances = Balances,
controllers = Controllers,
records = Records,
owner = Owner,
initialized = Initialized,
})
end

Expand Down

0 comments on commit ed04907

Please sign in to comment.