Skip to content

Commit

Permalink
fix: remove setter native token
Browse files Browse the repository at this point in the history
  • Loading branch information
obatirou committed Nov 21, 2024
1 parent aa3cedb commit 2eb0834
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 50 deletions.
3 changes: 0 additions & 3 deletions cairo_zero/kakarot/interfaces/interfaces.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ namespace IKakarot {
func get_owner() -> (owner: felt) {
}

func set_native_token(native_token_address: felt) {
}

func get_native_token() -> (native_token_address: felt) {
}

Expand Down
11 changes: 0 additions & 11 deletions cairo_zero/kakarot/kakarot.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@ func get_owner{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
return Ownable_owner.read();
}

// @notice Set the native token used by kakarot
// @dev Set the native token which will emulate the role of ETH on Ethereum
// @param native_token_address The address of the native token
@external
func set_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
native_token_address: felt
) {
Ownable.assert_only_owner();
return Kakarot.set_native_token(native_token_address);
}

// @notice Get the native token address
// @dev Return the address used to emulate the role of ETH on Ethereum
// @return native_token_address The address of the native token
Expand Down
10 changes: 0 additions & 10 deletions cairo_zero/kakarot/library.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ namespace Kakarot {
return (chain_id=chain_id);
}

// @notice Set the native Starknet ERC20 token used by kakarot.
// @dev Set the native token which will emulate the role of ETH on Ethereum.
// @param native_token_address The address of the native token.
func set_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
native_token_address: felt
) {
Kakarot_native_token_address.write(native_token_address);
return ();
}

// @notice Get the native token address
// @dev Return the address used to emulate the role of ETH on Ethereum
// @return native_token_address The address of the native token
Expand Down
10 changes: 0 additions & 10 deletions cairo_zero/tests/src/kakarot/test_kakarot.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ from kakarot.library import Kakarot
from kakarot.kakarot import (
eth_send_raw_unsigned_tx,
register_account,
set_native_token,
set_base_fee,
set_coinbase,
set_prev_randao,
Expand Down Expand Up @@ -134,15 +133,6 @@ func test__transfer_ownership{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, ra
return ();
}

func test__set_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() {
tempvar address;

%{ ids.address = program_input["address"] %}

set_native_token(address);
return ();
}

func test__set_coinbase{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() {
tempvar coinbase;

Expand Down
16 changes: 0 additions & 16 deletions cairo_zero/tests/src/kakarot/test_kakarot.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,6 @@ def test_should_unpause(self, cairo_run):
address=get_storage_var_address("Pausable_paused"), value=0
)

class TestNativeToken:
@pytest.mark.slow
@SyscallHandler.patch("Ownable_owner", 0xDEAD)
def test_should_assert_only_owner(self, cairo_run):
with cairo_error(message="Ownable: caller is not the owner"):
cairo_run("test__set_native_token", address=0xABC)

@SyscallHandler.patch("Ownable_owner", SyscallHandler.caller_address)
def test_should_set_native_token(self, cairo_run):
token_address = 0xABCDE12345
cairo_run("test__set_native_token", address=token_address)
SyscallHandler.mock_storage.assert_any_call(
address=get_storage_var_address("Kakarot_native_token_address"),
value=token_address,
)

class TestTransferOwnership:
@SyscallHandler.patch("Ownable_owner", 0xDEAD)
def test_should_assert_only_owner(self, cairo_run):
Expand Down

0 comments on commit 2eb0834

Please sign in to comment.