mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-10-04 06:48:03 +03:00
Merge commit 'ca9a6011ec90836d8d47efe196c2d4c77040613e' into checkpoint/main_from_release_2.1.2_ca9a6011ec90836d8d47efe196c2d4c77040613e
This commit is contained in:
commit
367f7e358a
@ -178,6 +178,9 @@ def dao_create_cmd(
|
||||
) -> None:
|
||||
from .dao_funcs import create_dao_wallet
|
||||
|
||||
if self_destruct == proposal_timelock:
|
||||
raise ValueError("Self Destruct and Proposal Timelock cannot be the same value")
|
||||
|
||||
print("Creating new DAO")
|
||||
|
||||
extra_params = {
|
||||
|
@ -884,6 +884,9 @@ async def print_balances(
|
||||
get_id_response = await wallet_client.dao_get_treasury_id(wallet_id)
|
||||
treasury_id = get_id_response["treasury_id"][2:]
|
||||
print(f"{indent}{'-Treasury ID:'.ljust(ljust)} {treasury_id}")
|
||||
elif typ == WalletType.DAO_CAT:
|
||||
cat_asset_id = summary["data"][32:96]
|
||||
print(f"{indent}{'-Asset ID:'.ljust(ljust)} {cat_asset_id}")
|
||||
elif len(asset_id) > 0:
|
||||
print(f"{indent}{'-Asset ID:'.ljust(ljust)} {asset_id}")
|
||||
print(f"{indent}{'-Wallet ID:'.ljust(ljust)} {wallet_id}")
|
||||
|
@ -2739,6 +2739,8 @@ class WalletRpcApi:
|
||||
if lci.active_votes == []:
|
||||
coins.append(lci)
|
||||
fee = uint64(request.get("fee", 0))
|
||||
if not coins: # pragma: no cover
|
||||
raise ValueError("There are not coins available to exit lockup")
|
||||
exit_tx = await dao_cat_wallet.exit_vote_state(
|
||||
coins,
|
||||
tx_config,
|
||||
|
@ -432,6 +432,8 @@ class DAOWallet:
|
||||
asset_id = None
|
||||
else:
|
||||
asset_id = get_asset_id_from_puzzle(parent_spend.puzzle_reveal.to_program())
|
||||
# to prevent fake p2_singletons being added
|
||||
assert coin.puzzle_hash == get_p2_singleton_puzhash(self.dao_info.treasury_id, asset_id=asset_id)
|
||||
if asset_id not in self.dao_info.assets:
|
||||
new_asset_list = self.dao_info.assets.copy()
|
||||
new_asset_list.append(asset_id)
|
||||
@ -540,8 +542,13 @@ class DAOWallet:
|
||||
int_from_bytes(cond.at("rrf").as_atom()) == 1
|
||||
):
|
||||
cat_tail_hash = bytes32(cond.at("rrrff").as_atom())
|
||||
cat_origin_id = bytes32(cond.at("rrrfrf").as_atom())
|
||||
# Calculate the CAT tail from the memo data. If someone tries to use a fake tail hash in
|
||||
# the memo field, it won't match with the DAO's actual treasury ID.
|
||||
cat_tail = generate_cat_tail(cat_origin_id, self.dao_info.treasury_id)
|
||||
break
|
||||
assert cat_tail_hash
|
||||
assert cat_tail.get_tree_hash() == cat_tail_hash
|
||||
|
||||
cat_wallet: Optional[CATWallet] = None
|
||||
|
||||
@ -560,6 +567,7 @@ class DAOWallet:
|
||||
)
|
||||
|
||||
assert cat_wallet is not None
|
||||
await cat_wallet.set_tail_program(bytes(cat_tail).hex())
|
||||
cat_wallet_id = cat_wallet.wallet_info.id
|
||||
dao_info = dataclasses.replace(
|
||||
self.dao_info,
|
||||
@ -732,7 +740,7 @@ class DAOWallet:
|
||||
origin_id=origin.name(),
|
||||
coins=set(coins),
|
||||
coin_announcements_to_consume=announcement_set,
|
||||
memos=[new_cat_wallet.cat_info.limitations_program_hash],
|
||||
memos=[new_cat_wallet.cat_info.limitations_program_hash, cat_origin.name()],
|
||||
)
|
||||
tx_record: TransactionRecord = tx_records[0]
|
||||
|
||||
@ -1819,6 +1827,7 @@ class DAOWallet:
|
||||
)
|
||||
await self.add_parent(new_state.coin.name(), future_parent)
|
||||
return
|
||||
index = index + 1
|
||||
|
||||
# check if we are the finished state
|
||||
if current_innerpuz == get_finished_state_inner_puzzle(singleton_id):
|
||||
@ -1941,26 +1950,29 @@ class DAOWallet:
|
||||
parent_coin_id = child_coin.name()
|
||||
|
||||
# If we reach here then we don't currently know about this coin
|
||||
new_proposal_info = ProposalInfo(
|
||||
singleton_id,
|
||||
puzzle,
|
||||
uint64(new_total_votes),
|
||||
uint64(new_yes_votes),
|
||||
current_coin,
|
||||
current_innerpuz,
|
||||
timer_coin, # if this is None then the proposal has finished
|
||||
block_height, # block height that current proposal singleton coin was created
|
||||
passed,
|
||||
ended,
|
||||
)
|
||||
new_dao_info.proposals_list.append(new_proposal_info)
|
||||
await self.save_info(new_dao_info)
|
||||
future_parent = LineageProof(
|
||||
new_state.coin.parent_coin_info,
|
||||
puzzle.get_tree_hash(),
|
||||
uint64(new_state.coin.amount),
|
||||
)
|
||||
await self.add_parent(new_state.coin.name(), future_parent)
|
||||
# We only want to add this coin if it has a timer coin since fake proposals without a timer can
|
||||
# be created.
|
||||
if found:
|
||||
new_proposal_info = ProposalInfo(
|
||||
singleton_id,
|
||||
puzzle,
|
||||
uint64(new_total_votes),
|
||||
uint64(new_yes_votes),
|
||||
current_coin,
|
||||
current_innerpuz,
|
||||
timer_coin, # if this is None then the proposal has finished
|
||||
block_height, # block height that current proposal singleton coin was created
|
||||
passed,
|
||||
ended,
|
||||
)
|
||||
new_dao_info.proposals_list.append(new_proposal_info)
|
||||
await self.save_info(new_dao_info)
|
||||
future_parent = LineageProof(
|
||||
new_state.coin.parent_coin_info,
|
||||
puzzle.get_tree_hash(),
|
||||
uint64(new_state.coin.amount),
|
||||
)
|
||||
await self.add_parent(new_state.coin.name(), future_parent)
|
||||
return
|
||||
|
||||
async def update_closed_proposal_coin(self, new_state: CoinSpend, block_height: uint32) -> None:
|
||||
|
@ -284,8 +284,8 @@
|
||||
; We are trying to close the proposal, so check whether it passed or failed
|
||||
(if
|
||||
(all
|
||||
(> TOTAL_VOTES lockup_innerpuzhashes_or_attendance_required)
|
||||
(> YES_VOTES (calculate_win_percentage TOTAL_VOTES previous_votes_or_pass_margin))
|
||||
(gte TOTAL_VOTES lockup_innerpuzhashes_or_attendance_required)
|
||||
(gte YES_VOTES (calculate_win_percentage TOTAL_VOTES previous_votes_or_pass_margin))
|
||||
)
|
||||
; Passed
|
||||
(list
|
||||
|
File diff suppressed because one or more lines are too long
@ -54,8 +54,8 @@
|
||||
(assert
|
||||
; (= (sha256tree my_solution) announcement_args) - quex suggested this. We don't need to check it now. Can be used for future functionality.
|
||||
(> (+ coin_amount ONE) PROPOSAL_MINIMUM_AMOUNT) ; >=
|
||||
(> total_votes Attendance_Required) ; TODO: we might want to change this to storing total cats and calculating like with yes votes
|
||||
(> yes_votes (calculate_win_percentage total_votes Pass_Margin))
|
||||
(gte total_votes Attendance_Required) ; TODO: we might want to change this to storing total cats and calculating like with yes votes
|
||||
(gte yes_votes (calculate_win_percentage total_votes Pass_Margin))
|
||||
(=
|
||||
announcement_source
|
||||
(calculate_coin_id
|
||||
|
@ -1 +1 @@
|
||||
ff02ffff01ff02ffff03ffff15ffff10ff825effffff010180ff1780ffff01ff02ffff01ff02ffff03ffff15ff820affff5f80ffff01ff02ffff01ff02ffff03ffff15ff8216ffffff05ffff14ffff12ff820affff8200bf80ffff01822710808080ffff01ff02ffff01ff02ffff03ffff09ff82027fffff02ff0affff04ff02ffff04ff822effffff04ffff02ff0cffff04ff02ffff04ffff05ffff04ffff05ff0580ffff04ff8204ffffff06ffff06ff058080808080ffff04ffff02ff0cffff04ff02ffff04ff0bffff04ffff0bffff0101ff820aff80ffff04ffff0bffff0101ff8216ff80ffff04ffff0bffff0101ff82057f80ffff04ffff0bffff0101ff8204ff80ffff04ffff0bffff0101ff0b80ff808080808080808080ffff04ffff02ff0effff04ff02ffff04ffff04ffff05ff0580ffff04ff8204ffffff06ffff06ff0580808080ff80808080ff808080808080ffff04ff825effff80808080808080ffff01ff02ffff01ff04ffff04ffff013effff04ff8204ffffff01808080ffff02ffff03ffff15ffff11ff825effffff010180ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ff2fffff04ffff11ff825effffff010180ffff04ffff04ffff05ffff06ff058080ffff018080ffff018080808080ff8205ff80ff0180ffff01ff02ffff018205ffff018080ff018080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff04ffff01ffffff02ffff03ff05ffff01ff02ffff01ff02ff08ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff08ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ffff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff0effff04ff02ffff04ffff05ff0580ff80808080ffff02ff0effff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ff018080
|
||||
ff02ffff01ff02ffff03ffff15ffff10ff825effffff010180ff1780ffff01ff02ffff01ff02ffff03ffff02ff1effff04ff02ffff04ff820affffff04ff5fff8080808080ffff01ff02ffff01ff02ffff03ffff02ff1effff04ff02ffff04ff8216ffffff04ffff05ffff14ffff12ff820affff8200bf80ffff018227108080ff8080808080ffff01ff02ffff01ff02ffff03ffff09ff82027fffff02ff0affff04ff02ffff04ff822effffff04ffff02ff0cffff04ff02ffff04ffff05ffff04ffff05ff0580ffff04ff8204ffffff06ffff06ff058080808080ffff04ffff02ff0cffff04ff02ffff04ff0bffff04ffff0bffff0101ff820aff80ffff04ffff0bffff0101ff8216ff80ffff04ffff0bffff0101ff82057f80ffff04ffff0bffff0101ff8204ff80ffff04ffff0bffff0101ff0b80ff808080808080808080ffff04ffff02ff16ffff04ff02ffff04ffff04ffff05ff0580ffff04ff8204ffffff06ffff06ff0580808080ff80808080ff808080808080ffff04ff825effff80808080808080ffff01ff02ffff01ff04ffff04ffff013effff04ff8204ffffff01808080ffff02ffff03ffff15ffff11ff825effffff010180ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ff2fffff04ffff11ff825effffff010180ffff04ffff04ffff05ffff06ff058080ffff018080ffff018080808080ff8205ff80ff0180ffff01ff02ffff018205ffff018080ff018080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff04ffff01ffffff02ffff03ff05ffff01ff02ffff01ff02ff08ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff08ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ffff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff16ffff04ff02ffff04ffff05ff0580ff80808080ffff02ff16ffff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ff20ffff15ff0bff058080ff018080
|
||||
|
@ -11,9 +11,9 @@
|
||||
"dao_cat_launcher": "a01a838d18d4e031e937c79fa3f80f213fa00a3e64af6c16a1f137770cd3a567",
|
||||
"dao_finished_state": "694c99e1fb07671771bbca3d110880693a9ecc37a6529891ec979d0f3e760eba",
|
||||
"dao_lockup": "d6215f0916715a69fbbf2d1a679f437fde81787adeb90c666642fb9c2deff7ce",
|
||||
"dao_proposal": "65bf3abac92f1390684e34d2955daecc5ae1dbb110782bb825ede09a1a77a1d5",
|
||||
"dao_proposal": "fe6d5c0373c1750598d137ce50b5b025a203655ccab4ab3329315abad49c3586",
|
||||
"dao_proposal_timer": "1acd912fca662d1474f7a6c762280fc1430875bef518883387086c1125027526",
|
||||
"dao_proposal_validator": "507197e6645e3741efc200de19edc4556be1352c09ce1c9edaad7f1a4fc9d6a1",
|
||||
"dao_proposal_validator": "92209b0f7efb2dbaaaa3aab94dcadcafa9d008d39661763841c7d92065b3fd34",
|
||||
"dao_spend_p2_singleton_v2": "7bc8942159e600f56a87e1d9c059c8705307ec2fb996a949503298dedfed00be",
|
||||
"dao_treasury": "637d78acd395b6bb03211bcfc5f5f2e878cba2d62b2f53871d49a8b928411b19",
|
||||
"dao_update_proposal": "fc032384cfece9b542c3e1ea77ba119fb1013a3d74b622302c0b670447e4343d",
|
||||
|
@ -37,4 +37,12 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defun gte (atom_a atom_b)
|
||||
(not (> atom_b atom_a))
|
||||
)
|
||||
|
||||
(defun lte (atom_a atom_b)
|
||||
(not (> atom_a atom_b))
|
||||
)
|
||||
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user