This file contains hidden or 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.24; | |
| import {BaseHook} from "v4-periphery/src/utils/BaseHook.sol"; | |
| import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; | |
| import {Hooks} from "v4-core/libraries/Hooks.sol"; | |
| import {PoolKey} from "v4-core/types/PoolKey.sol"; | |
| import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; | |
| import {TickMath} from "v4-core/libraries/TickMath.sol"; | |
| import {FixedPointMathLib} from "solmate/src/utils/FixedPointMathLib.sol"; |
This file contains hidden or 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
| import { useState } from 'react' | |
| import { Bell, ChevronDown, CreditCard, DollarSign, Home, PieChart, Settings, User } from 'lucide-react' | |
| import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" | |
| import { Button } from "@/components/ui/button" | |
| import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" | |
| import { Input } from "@/components/ui/input" | |
| import { Label } from "@/components/ui/label" | |
| import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" | |
| import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" |
This file contains hidden or 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.24; | |
| import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; | |
| import "@openzeppelin/contracts/utils/Pausable.sol"; | |
| import "@openzeppelin/contracts/access/AccessControl.sol"; | |
| import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
| contract Freed is Pausable, ReentrancyGuard, AccessControl { | |
| // Define roles |
This file contains hidden or 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 snforge_std::{declare, ContractClassTrait, cheat_caller_address, CheatSpan}; | |
| use ownable::IOwnableTraitDispatcher; | |
| use ownable::IOwnableTraitDispatcherTrait; | |
| use starknet::ContractAddress; | |
| use core::traits::TryInto; | |
| fn deploy_contract (name : ByteArray) -> ContractAddress { | |
| let admin_address : ContractAddress = 'admin'.try_into().unwrap(); | |
| let contract = declare(name).unwrap(); | |
| let (contract_address, _) = contract.deploy(@array![admin_address.into()]).unwrap(); |
This file contains hidden or 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; | |
| contract ERC20Token { | |
| string public name; | |
| uint8 public decimals; | |
| uint256 public totalSupply; | |
| mapping(address => uint256) public balances; | |
| mapping(address => mapping(address => uint256)) public allowances; |
This file contains hidden or 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; | |
| #[starknet::interface] | |
| trait ITodoList<TContractState> { | |
| fn addTodo(ref self: TContractState, description: felt252, deadline: u32) -> bool; | |
| fn updateTodo(ref self: TContractState, index: u32, description: felt252, deadline: u32) -> bool; | |
| fn getTodos(self: @TContractState) -> Array<Todo::Todo>; | |
| fn getTodo(self: @TContractState, index: u8); | |
| } |
This file contains hidden or 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; | |
| #[starknet::interface] | |
| trait IERC20<TContractState> { | |
| fn name(self: @TContractState) -> felt252; | |
| fn symbol(self: @TContractState) -> felt252; | |
| fn decimals(self: @TContractState) -> u8; | |
| fn totalSupply(self: @TContractState) -> u256; | |
| fn balanceOf(self: @TContractState, owner: ContractAddress) -> u256; |
This file contains hidden or 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
| function withdraw(uint _amount) public onlyVIP { | |
| // Check if the user has enough balance to withdraw | |
| require(balances[msg.sender] >= _amount, "Not enough ether"); | |
| // Check if the contract's balance after withdrawal remains non-negative | |
| // This prevents the contract from being overdrafted | |
| require( | |
| address(this).balance - _amount >= 0, | |
| "Cannot withdraw more than 0.5 ETH per transaction" | |
| ); |
This file contains hidden or 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.7; | |
| contract VIP_Bank { | |
| address public manager; | |
| mapping(address => uint) public balances; | |
| mapping(address => bool) public VIP; | |
| uint public maxETH = 0.5 ether; |
This file contains hidden or 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.9; | |
| contract SaveEther { | |
| mapping(address => uint256) savings; | |
| event SavingSuccessful(address indexed user, uint256 indexed amount); | |
| function deposit() external payable { | |
| require(msg.sender != address(0), "wrong EOA"); |
NewerOlder