-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dev/zivkovicmilos/ci-qol
- Loading branch information
Showing
24 changed files
with
763 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package home | ||
|
||
import ( | ||
"errors" | ||
"std" | ||
) | ||
|
||
var ( | ||
mainAddr = std.Address("g1ej0qca5ptsw9kfr64ey8jvfy9eacga6mpj2z0y") // matija's main address | ||
backupAddr std.Address // backup address | ||
|
||
errorInvalidAddr = errors.New("config: invalid address") | ||
errorUnauthorized = errors.New("config: unauthorized") | ||
) | ||
|
||
func Address() std.Address { | ||
return mainAddr | ||
} | ||
|
||
func Backup() std.Address { | ||
return backupAddr | ||
} | ||
|
||
func SetAddress(newAddress std.Address) error { | ||
if !newAddress.IsValid() { | ||
return errorInvalidAddr | ||
} | ||
|
||
if err := checkAuthorized(); err != nil { | ||
return err | ||
} | ||
|
||
mainAddr = newAddress | ||
return nil | ||
} | ||
|
||
func SetBackup(newAddress std.Address) error { | ||
if !newAddress.IsValid() { | ||
return errorInvalidAddr | ||
} | ||
|
||
if err := checkAuthorized(); err != nil { | ||
return err | ||
} | ||
|
||
backupAddr = newAddress | ||
return nil | ||
} | ||
|
||
func checkAuthorized() error { | ||
caller := std.GetOrigCaller() | ||
if caller != mainAddr && caller != backupAddr { | ||
return errorUnauthorized | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func AssertAuthorized() { | ||
caller := std.GetOrigCaller() | ||
if caller != mainAddr && caller != backupAddr { | ||
panic(errorUnauthorized) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module gno.land/r/matijamarjanovic/home |
Oops, something went wrong.