kopia lustrzana https://github.com/bugout-dev/dao
Added "setPoolController" external method to "TerminusFacet"
rodzic
bcec58be55
commit
b3addbb99f
|
@ -132,6 +132,11 @@ contract TerminusFacet is ERC1155WithTerminusStorage {
|
|||
return LibTerminus.terminusStorage().currentPoolID;
|
||||
}
|
||||
|
||||
function setPoolController(uint256 poolID, address newController) external {
|
||||
LibTerminus.enforcePoolIsController(poolID, msg.sender);
|
||||
LibTerminus.setPoolController(poolID, newController);
|
||||
}
|
||||
|
||||
function terminusPoolController(uint256 poolID)
|
||||
external
|
||||
view
|
||||
|
|
|
@ -214,6 +214,14 @@ class TerminusFacet:
|
|||
self.assert_contract_is_instantiated()
|
||||
return self.contract.setPoolBasePrice(new_base_price, transaction_config)
|
||||
|
||||
def set_pool_controller(
|
||||
self, pool_id: int, new_controller: ChecksumAddress, transaction_config
|
||||
) -> Any:
|
||||
self.assert_contract_is_instantiated()
|
||||
return self.contract.setPoolController(
|
||||
pool_id, new_controller, transaction_config
|
||||
)
|
||||
|
||||
def set_uri(self, pool_id: int, pool_uri: str, transaction_config) -> Any:
|
||||
self.assert_contract_is_instantiated()
|
||||
return self.contract.setURI(pool_id, pool_uri, transaction_config)
|
||||
|
@ -497,6 +505,18 @@ def handle_set_pool_base_price(args: argparse.Namespace) -> None:
|
|||
print(result)
|
||||
|
||||
|
||||
def handle_set_pool_controller(args: argparse.Namespace) -> None:
|
||||
network.connect(args.network)
|
||||
contract = TerminusFacet(args.address)
|
||||
transaction_config = get_transaction_config(args)
|
||||
result = contract.set_pool_controller(
|
||||
pool_id=args.pool_id,
|
||||
new_controller=args.new_controller,
|
||||
transaction_config=transaction_config,
|
||||
)
|
||||
print(result)
|
||||
|
||||
|
||||
def handle_set_uri(args: argparse.Namespace) -> None:
|
||||
network.connect(args.network)
|
||||
contract = TerminusFacet(args.address)
|
||||
|
@ -762,6 +782,16 @@ def generate_cli() -> argparse.ArgumentParser:
|
|||
)
|
||||
set_pool_base_price_parser.set_defaults(func=handle_set_pool_base_price)
|
||||
|
||||
set_pool_controller_parser = subcommands.add_parser("set-pool-controller")
|
||||
add_default_arguments(set_pool_controller_parser, True)
|
||||
set_pool_controller_parser.add_argument(
|
||||
"--pool-id", required=True, help="Type: uint256", type=int
|
||||
)
|
||||
set_pool_controller_parser.add_argument(
|
||||
"--new-controller", required=True, help="Type: address"
|
||||
)
|
||||
set_pool_controller_parser.set_defaults(func=handle_set_pool_controller)
|
||||
|
||||
set_uri_parser = subcommands.add_parser("set-uri")
|
||||
add_default_arguments(set_uri_parser, True)
|
||||
set_uri_parser.add_argument(
|
||||
|
|
|
@ -141,6 +141,50 @@ class TestPoolOperations(TerminusTestCase):
|
|||
def setUp(self) -> None:
|
||||
self.diamond_terminus.create_simple_pool(10, {"from": accounts[1]})
|
||||
|
||||
def test_set_pool_controller(self):
|
||||
pool_id = self.diamond_terminus.total_pools()
|
||||
old_controller = accounts[1]
|
||||
new_controller = accounts[2]
|
||||
|
||||
current_controller_address = self.diamond_terminus.terminus_pool_controller(
|
||||
pool_id
|
||||
)
|
||||
self.assertEqual(current_controller_address, old_controller.address)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
self.diamond_terminus.set_pool_controller(
|
||||
pool_id, new_controller.address, {"from": new_controller}
|
||||
)
|
||||
current_controller_address = self.diamond_terminus.terminus_pool_controller(
|
||||
pool_id
|
||||
)
|
||||
self.assertEqual(current_controller_address, old_controller.address)
|
||||
|
||||
self.diamond_terminus.set_pool_controller(
|
||||
pool_id, new_controller.address, {"from": old_controller}
|
||||
)
|
||||
current_controller_address = self.diamond_terminus.terminus_pool_controller(
|
||||
pool_id
|
||||
)
|
||||
self.assertEqual(current_controller_address, new_controller.address)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
self.diamond_terminus.set_pool_controller(
|
||||
pool_id, old_controller.address, {"from": old_controller}
|
||||
)
|
||||
current_controller_address = self.diamond_terminus.terminus_pool_controller(
|
||||
pool_id
|
||||
)
|
||||
self.assertEqual(current_controller_address, new_controller.address)
|
||||
|
||||
self.diamond_terminus.set_pool_controller(
|
||||
pool_id, old_controller.address, {"from": new_controller}
|
||||
)
|
||||
current_controller_address = self.diamond_terminus.terminus_pool_controller(
|
||||
pool_id
|
||||
)
|
||||
self.assertEqual(current_controller_address, old_controller.address)
|
||||
|
||||
def test_mint(self):
|
||||
pool_id = self.diamond_terminus.total_pools()
|
||||
self.diamond_terminus.mint(accounts[2], pool_id, 1, b"", {"from": accounts[1]})
|
||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ with open("README.md") as ifp:
|
|||
|
||||
setup(
|
||||
name="moonstream-dao",
|
||||
version="0.0.1",
|
||||
version="0.0.2",
|
||||
packages=find_packages(),
|
||||
install_requires=["eth-brownie", "tqdm"],
|
||||
extras_require={
|
||||
|
|
Ładowanie…
Reference in New Issue