-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35b1de6
commit 158bdaf
Showing
59 changed files
with
7,047 additions
and
10 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
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
test4.gno.land/extracted/p/g1w9rlvl7nchzn5d3p8hyy78js5l4j6fc8gjp0an/hello/package.gno
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,5 @@ | ||
package hello | ||
|
||
func Render(path string) string { | ||
return "Hello World!" | ||
} |
1 change: 1 addition & 0 deletions
1
test4.gno.land/extracted/p/g1w9rlvl7nchzn5d3p8hyy78js5l4j6fc8gjp0an/hello/pkg_metadata.json
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 @@ | ||
{"creator":"g1w9rlvl7nchzn5d3p8hyy78js5l4j6fc8gjp0an","deposit":""} |
62 changes: 62 additions & 0 deletions
62
test4.gno.land/extracted/r/ecodevx/dao/pre1:2145604/LICENSE
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,62 @@ | ||
Copyright (c) 2024. All rights reserved. | ||
|
||
Project Owner: | ||
NewTendermint, LLC | ||
|
||
Project Maintainer: | ||
İlker Göktuğ ÖZTÜRK. <[email protected]>, <[email protected]> | ||
|
||
Your access to this Project and your contributions to this Project are subject | ||
to the following terms: | ||
|
||
* You hereby grant to the listed Owner and Maintainer of this Project the | ||
worldwide, irrevocable and royalty-free right to use, publish, relicense and | ||
sublicense your contributions under any non-exclusive license of their | ||
choosing for commercial and non-commercial purposes. | ||
* You shall not attempt to bring any intellectual property infringement or | ||
misappropriation claims against the Owner or Maintainer of this Project | ||
relating to or arising from your contributions. | ||
* You represent that you are the sole owner of all rights in your | ||
contributions and that no third party has any rights or interests therein. | ||
|
||
FOR THE SCOPE OF THIS LICENSE, A CONTRIBUTION IS DEFINED TO INCLUDE ANY WORKS, | ||
IDEAS, CODE, PROCESSES, OR APIS MADE AVAILABLE TO VIEW BY THE GENERAL PUBLIC | ||
(INCLUDING ANY PUBLICLY ACCESSIBLE INTERNET FORUMS AND CHAT SERVERS WHERE | ||
ACCESS IS AVAILABLE FOR FREE WITH REGISTRATION) OR PRIVATELY TO THIS PROJECT'S | ||
OWNER AND MAINTAINERS; INCLUDING WORKS, IDEAS, CODE, PROCESSES, AND APIS THAT | ||
ARE ABOUT THIS PROJECT AND ITS CONTRIBUTIONS, OR MENTIONED IN REFERENCE TO | ||
THIS PROJECT, WHERE SUCH WORKS, IDEAS, CODE, PROCESSES, AND APIS ARE MATERIAL | ||
TO THE SUCCESS, IMPROVEMENT, OR COMPLETION OF THIS PROJECT, AS DETERMINED BY | ||
THE OWNER OF THIS PROJECT. | ||
|
||
Contributions may come in any form, and include (but are not limited to): | ||
|
||
* pull requests | ||
* diff patches | ||
* commentary | ||
* example code | ||
|
||
If you do not want your contribution to become incorporated into this Project, | ||
do not make contributions to this Project. The creation of contributions that | ||
may in the future become known to this Project's Owner and Maintainer | ||
constitutes a willing contribution to this Project in accordance with this | ||
license. | ||
|
||
THIS PROJECT AND THE WORKS AVAILABLE THROUGH THIS PROJECT ARE PROVIDED “AS IS” | ||
AND WITHOUT WARRANTY OF ANY KIND. IN NO EVENT SHALL THE OWNER OR MAINTAINER OF | ||
THIS PROJECT BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THIS PROJECT OR THE WORKS AVAILABLE THROUGH | ||
THIS PROJECT. YOU AGREED TO INDEMNIFY, DEFEND AND HOLD THE OWNER AND | ||
MAINTAINER FROM AND AGAINST ANY CLAIMS, LOSSES OR DAMAGES ARISING FROM YOUR | ||
USE OF THIS PROJECT OR THE WORKS AVAILABLE THROUGH THIS PROJECT. | ||
|
||
This license is subject to change at any time by the Project Owner or | ||
Maintainer. | ||
|
||
Your continued access to or use of this Project or any works | ||
available through this Project shall be subject to the then-current version | ||
of this license. | ||
|
||
The Project Owner and Maintainer reserve the right to change this license | ||
without needing the consent of the contributors to this Project. |
68 changes: 68 additions & 0 deletions
68
test4.gno.land/extracted/r/ecodevx/dao/pre1:2145604/gnome.gno
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,68 @@ | ||
package gnome | ||
|
||
import ( | ||
"strings" | ||
|
||
gnome "gno.land/p/ecodevx/dao" | ||
) | ||
|
||
// Names of the initial DAOs. | ||
const ( | ||
nameCouncilDAO = "council" | ||
nameMainDAO = "main" | ||
) | ||
|
||
// Member roles. | ||
const ( | ||
RoleAdmin gnome.Role = "admin" | ||
RoleEcoDev gnome.Role = "eco-dev" | ||
RoleDev gnome.Role = "dev" | ||
RoleRealm gnome.Role = "realm" | ||
) | ||
|
||
// The "Gno.me" DAO defines an initial root DAO with a single sub DAO, where the root is | ||
// the council DAO and the child is the main DAO. Council DAO members are hard coded and | ||
// can't be modified. Main DAO members can be modified anytime though a modify DAO members | ||
// proposals. | ||
// | ||
// The main DAO must have a minimum of three members at all time to be able to apply 2/3s | ||
// voting majority criteria required for some proposal types allowed for the main DAO. | ||
// | ||
// Sub DAOs can be created though sub DAO add proposals but its members can't be modified | ||
// once the sub DAO is created. Sub DAOs must be dismissed though a proposal and a new sub | ||
// DAO must be created if its members must be modified. | ||
var gnomeDAO = gnome.MustNew( | ||
nameCouncilDAO, | ||
"Council", | ||
gnome.WithManifest("Gnomes are thinking"), | ||
gnome.AssignAsSuperCouncil(), | ||
gnome.WithMembers( | ||
gnome.NewMember("g1lyzcpa7duh69lk04nahxup484xrz4k6k2nqdun", RoleDev), | ||
gnome.NewMember("g125t352u4pmdrr57emc4pe04y40sknr5ztng5mt", RoleDev), | ||
gnome.NewMember("g1778y2yphxs2wpuaflsy5y9qwcd4gttn4g5yjx5", RoleEcoDev), | ||
), | ||
gnome.WithSubDAO( | ||
gnome.MustNew( | ||
nameMainDAO, | ||
"Main", | ||
gnome.WithManifest("Gnomes are building"), | ||
gnome.WithMembers( | ||
gnome.NewMember("g1lyzcpa7duh69lk04nahxup484xrz4k6k2nqdun", RoleDev), | ||
gnome.NewMember("g125t352u4pmdrr57emc4pe04y40sknr5ztng5mt", RoleDev), | ||
gnome.NewMember("g1778y2yphxs2wpuaflsy5y9qwcd4gttn4g5yjx5", RoleEcoDev), | ||
), | ||
), | ||
), | ||
) | ||
|
||
func mustGetDAO(path string) *gnome.DAO { | ||
if strings.TrimSpace(path) == "" { | ||
panic("DAO path is empty") | ||
} | ||
|
||
dao, found := daos.GetByPath(path) | ||
if !found { | ||
panic("DAO not found") | ||
} | ||
return dao | ||
} |
102 changes: 102 additions & 0 deletions
102
test4.gno.land/extracted/r/ecodevx/dao/pre1:2145604/indexes.gno
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,102 @@ | ||
package gnome | ||
|
||
import ( | ||
"gno.land/p/demo/avl" | ||
|
||
gnome "gno.land/p/ecodevx/dao" | ||
) | ||
|
||
var ( | ||
daos daoIndex | ||
proposals proposalIndex | ||
lastProposalID gnome.ID | ||
) | ||
|
||
func init() { | ||
// Index initial council and main DAO | ||
mainDAO := gnomeDAO.SubDAOs()[0] | ||
daos.IndexByPath(gnomeDAO) | ||
daos.IndexByPath(mainDAO) | ||
} | ||
|
||
func genProposalID() gnome.ID { | ||
lastProposalID += 1 | ||
return lastProposalID | ||
} | ||
|
||
// TODO: Deprecate DAO index in favor of using DAO methods | ||
type daoIndex struct { | ||
index avl.Tree // string(DAO path) -> *gnome.DAO | ||
} | ||
|
||
// IndexByPath indexes a DAO by its path. | ||
func (x *daoIndex) IndexByPath(dao *gnome.DAO) bool { | ||
return x.index.Set(dao.Path(), dao) | ||
} | ||
|
||
// GetByPath gets a DAO by its path. | ||
func (x daoIndex) GetByPath(path string) (*gnome.DAO, bool) { | ||
if v, ok := x.index.Get(path); ok { | ||
return v.(*gnome.DAO), true | ||
} | ||
return nil, false | ||
} | ||
|
||
// HasPathKey checks if a key with a DAO path exists. | ||
func (x daoIndex) HasPathKey(path string) bool { | ||
return x.index.Has(path) | ||
} | ||
|
||
type proposalIndex struct { | ||
index avl.Tree // string(binary gnome.ID) -> *gnome.Proposal | ||
groups avl.Tree // string(DAO path) -> []*gnome.Proposal | ||
} | ||
|
||
// Index indexes a proposal by its ID and DAO. | ||
func (x *proposalIndex) Index(p *gnome.Proposal) { | ||
x.IndexByID(p) | ||
x.IndexByDAO(p) | ||
} | ||
|
||
// IndexByID indexes a proposal by its ID. | ||
func (x *proposalIndex) IndexByID(p *gnome.Proposal) bool { | ||
return x.index.Set(p.ID().Key(), p) | ||
} | ||
|
||
// IndexByDAO indexes a proposal for a DAO. | ||
func (x *proposalIndex) IndexByDAO(p *gnome.Proposal) bool { | ||
daoPath := p.DAO().Path() | ||
proposals := x.GetAllByDAO(daoPath) | ||
proposals = append([]*gnome.Proposal{p}, proposals...) // reverse append | ||
return x.groups.Set(daoPath, proposals) | ||
} | ||
|
||
// GetByID gets a proposal by its ID. | ||
func (x proposalIndex) GetByID(id gnome.ID) (*gnome.Proposal, bool) { | ||
if v, exists := x.index.Get(id.Key()); exists { | ||
return v.(*gnome.Proposal), true | ||
} | ||
return nil, false | ||
} | ||
|
||
// GetAllByDAO gets all proposals of a DAO. | ||
func (x proposalIndex) GetAllByDAO(daoPath string) []*gnome.Proposal { | ||
if v, exists := x.groups.Get(daoPath); exists { | ||
return v.([]*gnome.Proposal) | ||
} | ||
return nil | ||
} | ||
|
||
// Iterate iterates proposals starting from the oldest one. | ||
func (x proposalIndex) Iterate(fn gnome.ProposalIterFn) bool { | ||
return x.index.Iterate("", "", func(_ string, v interface{}) bool { | ||
return fn(v.(*gnome.Proposal)) | ||
}) | ||
} | ||
|
||
// ReverseIterate iterates proposals starting from the latest one. | ||
func (x proposalIndex) ReverseIterate(fn gnome.ProposalIterFn) bool { | ||
return x.index.ReverseIterate("", "", func(_ string, v interface{}) bool { | ||
return fn(v.(*gnome.Proposal)) | ||
}) | ||
} |
46 changes: 46 additions & 0 deletions
46
test4.gno.land/extracted/r/ecodevx/dao/pre1:2145604/params.gno
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,46 @@ | ||
package gnome | ||
|
||
import ( | ||
"time" | ||
|
||
gnome "gno.land/p/ecodevx/dao" | ||
) | ||
|
||
// Day defines the duration of a day. | ||
const Day = time.Hour * 24 | ||
|
||
// Names for the different strategy types. | ||
const ( | ||
StrategyNameSubDAOCreation = "sub-dao-creation" | ||
StrategyNameSubDAODismissal = "sub-dao-dismissal" | ||
StrategyNameDAOMembersModification = "dao-members-modification" | ||
StrategyNameBudget = "budget" | ||
StrategyNameGeneral = "general" | ||
StrategyNameLocking = "locking" | ||
StrategyNameParamsUpdate = "params-update" | ||
) | ||
|
||
var parameters struct { | ||
// VotingPeriods contains the current voting period for each proposal type. | ||
VotingPeriods gnome.DurationParams | ||
|
||
// ReviewDeadline defines the time after which a proposal can't be withdrawed by the proposer. | ||
// Proposal can only be voted on after this deadline but not before. | ||
// This greace period gives the proposer the chance to withdraw a proposal if there is a mistake. | ||
ReviewDeadline time.Duration | ||
} | ||
|
||
func init() { | ||
// Initial voting periods for each proposal type. | ||
// Periods can be changed by sumitting a params update proposal. | ||
parameters.VotingPeriods.Set(StrategyNameSubDAOCreation, time.Minute*10) | ||
parameters.VotingPeriods.Set(StrategyNameSubDAODismissal, Day*7) | ||
parameters.VotingPeriods.Set(StrategyNameDAOMembersModification, time.Minute*30) | ||
parameters.VotingPeriods.Set(StrategyNameBudget, Day*7) | ||
parameters.VotingPeriods.Set(StrategyNameGeneral, Day*2) | ||
parameters.VotingPeriods.Set(StrategyNameLocking, Day*2) | ||
parameters.VotingPeriods.Set(StrategyNameParamsUpdate, time.Minute*10) | ||
|
||
// Initial review deadline | ||
parameters.ReviewDeadline = time.Second | ||
} |
1 change: 1 addition & 0 deletions
1
test4.gno.land/extracted/r/ecodevx/dao/pre1:2145604/pkg_metadata.json
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 @@ | ||
{"creator":"g147ah9520z0r6jh9mjr6c75rv6l8aypzvcd3f7d","deposit":"1ugnot"} |
Oops, something went wrong.