forked from Flex-NFT-Marketplace/Flex-Marketplace-Contract
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 12db4ea
Showing
154 changed files
with
18,755 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
%lang starknet | ||
|
||
from starkware.cairo.common.cairo_builtins import HashBuiltin, SignatureBuiltin | ||
from starkware.cairo.common.math import assert_not_equal | ||
|
||
from contracts.utils.constants import TRUE | ||
|
||
@storage_var | ||
func ERC165_supported_interfaces(interface_id: felt) -> (is_supported: felt) { | ||
} | ||
|
||
func ERC165_supports_interface{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( | ||
interface_id: felt | ||
) -> (success: felt) { | ||
// 165 | ||
if (interface_id == 0x01ffc9a7) { | ||
return (TRUE,); | ||
} | ||
|
||
// Checks interface registry | ||
let (is_supported) = ERC165_supported_interfaces.read(interface_id); | ||
return (is_supported,); | ||
} | ||
|
||
func ERC165_register_interface{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( | ||
interface_id: felt | ||
) { | ||
// Ensures interface_id is not the invalid interface_id | ||
assert_not_equal(interface_id, 0xffffffff); | ||
ERC165_supported_interfaces.write(interface_id, TRUE); | ||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%lang starknet | ||
|
||
@contract_interface | ||
namespace IERC165 { | ||
func supportsInterface(interfaceId: felt) -> (success: felt) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
%lang starknet | ||
|
||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
from starkware.starknet.common.syscalls import get_caller_address | ||
|
||
@storage_var | ||
func Ownable_owner() -> (owner: felt) { | ||
} | ||
|
||
func Ownable_initializer{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( | ||
owner: felt | ||
) { | ||
Ownable_owner.write(owner); | ||
return (); | ||
} | ||
|
||
func Ownable_only_owner{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() { | ||
let (owner) = Ownable_owner.read(); | ||
let (caller) = get_caller_address(); | ||
assert owner = caller; | ||
return (); | ||
} | ||
|
||
func Ownable_get_owner{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> ( | ||
owner: felt | ||
) { | ||
let (owner) = Ownable_owner.read(); | ||
return (owner=owner); | ||
} | ||
|
||
func Ownable_transfer_ownership{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( | ||
new_owner: felt | ||
) -> (new_owner: felt) { | ||
Ownable_only_owner(); | ||
Ownable_owner.write(new_owner); | ||
return (new_owner=new_owner); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Declare this file as a StarkNet contract. | ||
%lang starknet | ||
|
||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
|
||
// Define a storage variable. | ||
@storage_var | ||
func balance() -> (res: felt) { | ||
} | ||
|
||
// Increases the balance by the given amount. | ||
@external | ||
func increase_balance{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( | ||
amount: felt | ||
) { | ||
let (res) = balance.read(); | ||
balance.write(res + amount); | ||
return (); | ||
} | ||
|
||
// Returns the current balance. | ||
@view | ||
func get_balance{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (res: felt) { | ||
let (res) = balance.read(); | ||
return (res,); | ||
} |
Oops, something went wrong.