near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
108 stars 77 forks source link

unknown variant `type` #82

Closed kulame closed 2 years ago

kulame commented 2 years ago
near call cryptdao3.kula.testnet add_proposal '{"proposal": {"target": "illia", "description": "test", "kind": {"type": "ChangePolicy", "policy": [{"max_amount": "100", "votes": 2}, {"max_amount": "1000", "votes": 3}, {"max_amount": "2000", "votes": [1, 2]}, {"max_amount": "10000000", "votes": [2, 3]}]}}}'  --accountId=kula.testnet --amount=0.1
    ExecutionError: 'Smart contract panicked: panicked at \'Failed to deserialize input from JSON.: Error("unknown variant `type`, expected one of `ChangeConfig`, `ChangePolicy`, `AddMemberToRole`, `RemoveMemberFromRole`, `FunctionCall`, `UpgradeSelf`, `UpgradeRemote`, `Transfer`, `Vote`", line: 1, column: 65)\', src/proposols.rs:181:1'

how can i set kind with the proposal?

ctindogaru commented 2 years ago

You're looking over V1 of Sputnik which is no longer supported. For V2 please access https://github.com/near-daos/sputnik-dao-contract/tree/main/sputnikdao2

For your use case, I'll give you a more elaborated example. You can adjust it accordingly:

near call cryptdao3.kula.testnet add_proposal '{"description":"new policy","kind":{"ChangePolicy":{"policy":{"roles":[{"name":"all","kind":"Everyone","permissions":["*:AddProposal"],"vote_policy":{}},{"name":"council","kind":{"Group":["user2","user1"]},"permissions":["*:*"],"vote_policy":{}},{"name":"community","kind":{"Group":["user3","user1","user4"]},"permissions":["*:*"],"vote_policy":{}}],"default_vote_policy":{"weight_kind":"RoleWeight","quorum":"0","threshold":[1,2]},"proposal_bond":"1000000000000000000000000","proposal_period":"604800000000000","bounty_bond":"1000000000000000000000000","bounty_forgiveness_period":"86400000000000"}}}}' --accountId=kula.testnet --amount=0.1
mikedotexe commented 2 years ago

Thanks, Constantin for your response. I believe this is good to close now.