feat: SDK improvements

Add a way to pull stateless contracts code from node, add more settings to test_assets.yaml, add logic to allow dynamic stateless contract by calling another contract
This commit is contained in:
Florian Pellissier
2024-07-30 12:18:45 +02:00
committed by kayibal
parent 3fab5d6ea7
commit a6cff51bf6
6 changed files with 77 additions and 22 deletions

View File

@@ -74,6 +74,7 @@ class ERC20OverwriteFactory:
self._overwrites = dict()
self._balance_slot: Final[int] = 0
self._allowance_slot: Final[int] = 1
self._total_supply_slot: Final[int] = 2
def set_balance(self, balance: int, owner: Address):
"""
@@ -111,6 +112,19 @@ class ERC20OverwriteFactory:
f"spender={spender} value={allowance} slot={storage_index}",
)
def set_total_supply(self, supply: int):
"""
Set the total supply of the token.
Parameters:
supply: The total supply value.
"""
self._overwrites[self._total_supply_slot] = supply
log.log(
5,
f"Override total supply: token={self._token.address} supply={supply}"
)
def get_protosim_overwrites(self) -> dict[Address, dict[int, int]]:
"""
Get the overwrites dictionary of previously collected values.