-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Action factory for vote action - we use factory to create actions, and the generic runAction method to execute them
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:hypha_wallet/core/crypto/seeds_esr/eos_action.dart'; | ||
|
||
class Voteactionfactory { | ||
// Vote action | ||
// Note: Don't hard-code the dao contract since it's different on different networks | ||
// get daoContract by calling | ||
// final daoContract = remoteConfigService.daoContract(network: network); | ||
// | ||
static EOSAction voteAction(String daoContract, String voter, int proposalId, String vote) { | ||
if (vote != 'pass' && vote != 'fail') { | ||
throw 'vote needs to be one of pass or fail'; | ||
} | ||
return EOSAction() | ||
..account = daoContract | ||
..name = 'vote' | ||
..data = { | ||
'voter': voter, | ||
'proposal_id': proposalId, | ||
'vote': vote, | ||
}; | ||
} | ||
} |
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