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
use starknet::{ContractAddress, contract_address_to_felt252, account::Call}; | |
use traits::TryInto; | |
use array::{ArrayTrait, SpanTrait}; | |
use result::ResultTrait; | |
use option::OptionTrait; | |
use integer::u256_from_felt252; | |
use snforge_std::{declare, start_prank, stop_prank, ContractClassTrait, ContractClass, io::PrintTrait}; | |
use token_bound_accounts::account::account::IAccountDispatcher; | |
use token_bound_accounts::account::account::IAccountDispatcherTrait; |
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
//SPDX-License-Identifier: MIT | |
pragma solidity >= 0.8.0 < 0.9.0; | |
contract ERC20 { | |
string public name; | |
string public symbol; | |
uint8 public decimals; | |
uint256 public totalSupply; | |
mapping(address => uint256) public balanceOf; | |
mapping(address => mapping(address => uint256)) public allowance; |
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
pragma solidity >=0.8.0; | |
interface IICO { | |
event registered(address indexed _address, bool status); | |
event claimed(address indexed _address, bool status); | |
function register() external payable; | |
function claim(address _address) external returns(bool); | |
} |
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
%lang starknet | |
from starkware.cairo.common.math import assert_nn | |
from starkware.cairo.common.cairo_builtins import HashBuiltin | |
@storage_var | |
func balance() -> (res: felt) { | |
} | |
@constructor | |
func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(input: 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
WHAT IS A SMART CONTRACT? HOW ARE THEY DEPLOYED? | |
Technically speaking, smart contracts are computer programs intended to automatically execute, control or document legally relevant events and actions according to the terms of a contract or agreement. | |
Deployment of a smart contract is a necessary step, one must take to make a smart contract available to everyone on the ethereum network. To deploy a contract: | |
1. You must first generate its bytecode through compilation. Since solidity is a high level programming language, you must convert it to a low-level language which can be understood by the Ethereum virtual machine. | |
2. You'll need to have ETH for gas fees. | |
3. You'll need a deployment script or plugin. | |
4. Lastly, you'll need to connect to an ethereum node, either by running yours or using API keys from providers like Infura or Alchemy. | |
Once you deploy your contract, it is given an Ethereum address like other accounts. | |
WHAT IS GAS? WHY IS GAS OPTIMIZATION SUCH A BIG FOCUS WHEN BUILDING SMART CONTRACTS? |