SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'/*
This is just an experiment. I dont know enough about how
DVM works to know if any of this is safe or private
I have some ideas about what I want to do with this but its a WIP.
/*
Function PasswordInsert(id String, password String)
IF EXISTS(SIGNER(id)) THEN GOTO 50 //ID already exits
STORE(SIGNER(id), password)
50 RETURN 0
End Function
/*Function GenerateDB()
LET pw = MAPGET(id)
STORE(,pw)
RETURN
End Function*/
Function PasswordGet(id String)
IF EXISTS(SIGNER(id)) GOTO 20
RETURN 1
20 LOAD(SIGNER(id))
RETURN 0
End Function
Function PasswordDelete(id)
DELETE(SIGNER(id))
End Function
// This function is used to initialize parameters during install time
// InitializePrivate initializes a private SC
Function InitializePrivate() Uint64
10 STORE("owner", SIGNER()) // Store in DB ["owner"] = address
40 RETURN 0
End Function
// if signer is owner, provide him rights to update code anytime
// make sure update is always available to SC
Function UpdateCode( code String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 RETURN 0
End Function'] |