Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/sell #350

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d841608
feat/add sell outcome token feature
annasambrook Nov 7, 2024
501b33d
fix error in reported message
annasambrook Nov 12, 2024
65cb73a
add return amount and sell outcome token round
annasambrook Nov 13, 2024
b7e7a51
chore: generators
annasambrook Nov 13, 2024
a50ecad
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/sell
annasambrook Nov 13, 2024
1284dfb
chore: generators
annasambrook Nov 13, 2024
7cf0997
make requested changes
annasambrook Nov 15, 2024
4188687
Merge remote-tracking branch 'refs/remotes/origin/hotfix/staking-kpi-…
annasambrook Nov 22, 2024
104de4f
make suggested changes
annasambrook Nov 22, 2024
e35ce11
chore: generators
annasambrook Nov 22, 2024
1711625
fix: change copyright date
annasambrook Nov 22, 2024
502897e
chore: generators
annasambrook Nov 22, 2024
32fb70d
Merge branch 'refs/heads/hotfix/staking-kpi-reachability' into feat/sell
annasambrook Dec 5, 2024
445998e
add: previous_vote and sell logic
annasambrook Dec 5, 2024
fe78d74
add: initial fsm changes to include sell outcome token round
annasambrook Dec 5, 2024
3fd007f
chore: generators
annasambrook Dec 5, 2024
5e0524c
fix: copyright date
annasambrook Dec 6, 2024
6f47bf1
Merge branch 'hotfix/staking-kpi-reachability' into feat/sell
Adamantios Dec 6, 2024
b65ba87
chore: ignore bandit's false positive error
Adamantios Dec 6, 2024
e9ba6ee
chore: run generators
Adamantios Dec 6, 2024
a3aae14
feat: update the bets so that we store investments per vote
Adamantios Dec 6, 2024
89cd038
chore: create an action to enforce a merge rule for `main`
Adamantios Dec 6, 2024
cf12051
Merge pull request #367 from valory-xyz/feat/bets-structure
Adamantios Dec 9, 2024
3dc7f7e
Merge remote-tracking branch 'origin/feat/sell' into feat/sell
annasambrook Dec 9, 2024
2709c8c
fix: approval tx status
annasambrook Dec 9, 2024
f919d2e
fix: build approval tx
annasambrook Dec 9, 2024
0a5fc2c
fix: make return amount property
annasambrook Dec 9, 2024
d0e3497
fix: build approval tx token
annasambrook Dec 9, 2024
2f0afa2
fix: remove is wxdai check
annasambrook Dec 9, 2024
87d1205
chore: generators
annasambrook Dec 9, 2024
79191b9
Merge branch 'refs/heads/hotfix/staking-kpi-reachability' into feat/sell
annasambrook Dec 9, 2024
2e90b9e
chore: generators
annasambrook Dec 9, 2024
cdfa138
chore: generators
annasambrook Dec 9, 2024
d234b5e
Update packages/valory/skills/decision_maker_abci/behaviours/bet_plac…
annasambrook Dec 9, 2024
235881b
Update packages/valory/skills/decision_maker_abci/behaviours/bet_plac…
annasambrook Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def __init__(self, **kwargs: Any) -> None:
"""Initialize the sell token behaviour."""
super().__init__(**kwargs)
self.sell_amount: float = 0.0
self.return_amount: int = 0

@property
def market_maker_contract_address(self) -> str:
Expand All @@ -58,7 +57,20 @@ def market_maker_contract_address(self) -> str:
@property
def outcome_index(self) -> int:
"""Get the index of the outcome for which the service is going to sell token."""
return cast(int, self.synchronized_data.vote)
return cast(int, self.synchronized_data.previous_vote)

@property
def return_amount(self) -> int:
"""Get the amount expected to be returned after the sell tx. """
previous_vote = self.synchronized_data.previous_vote

if previous_vote == 0:
return self.sampled_bet.invested_amount_yes

else:
return self.sampled_bet.invested_amount_no
Comment on lines +67 to +71
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot know if index 0 will always be "yes".

You could extract the following logic to a separate method and reuse it here:

if vote is None:
return False
vote_name = self.get_outcome(vote)
to_update = self.investments[vote_name]




def _build_approval_tx(self) -> WaitableConditionType:
"""Build an ERC20 approve transaction."""
Expand Down