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
| // starknet3.cairo | |
| // Joe liked Jill's work very much. He really likes how useful storage can be. | |
| // Now they decided to write a contract to track the number of exercises they | |
| // complete successfully. Jill says they can use the owner code and allow | |
| // only the owner to update the contract, they agree. | |
| // Can you help them write this contract? | |
| // I AM NOT DONE | |
| use starknet::ContractAddress; |
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
| #[starknet::contract] | |
| mod A{ | |
| use starknet::ContractAddress; | |
| #[storage] | |
| struct Storage{ | |
| owner: ContractAddress | |
| } | |
| #[constructor] |
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
| #[contract] | |
| mod ERC20{ | |
| //////////////// | |
| // LIBRARY IMPORTS | |
| ////////////// | |
| use starknet::ContractAddress; | |
| use zeroable::Zeroable; |
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; | |
| //////////////////////// | |
| // IERC721 interface | |
| /////////////////////// | |
| #[abi] | |
| trait IERC721{ | |
| fn name() -> felt252; | |
| fn symbol() -> felt252; |
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
| #[abi] | |
| trait IERC20 { | |
| #[view] | |
| fn get_name() -> felt252; | |
| #[view] | |
| fn get_symbol() -> felt252; | |
| #[view] | |
| fn total_supply() -> felt252; |
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
| //@Ademola Kelvin | |
| contract Conversions { | |
| function explicit256To8() public pure returns (uint8) { | |
| uint256 a = 2022; | |
| uint8 b = uint8(a); | |
| return b; // 230. | |
| } | |
| } |
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: GPL-3.0 | |
| pragma solidity 0.8.4; | |
| contract Energy{ | |
| //have total supply | |
| //transferrable | |
| //name | |
| //symbol |
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: GPL-3.0 | |
| pragma solidity ^0.8.4; | |
| /// ogbeni | |
| error Unauthorized(); | |
| /// @custom:experimental This is an experimental contract. | |
| contract VendingMachine { | |
| address payable owner = payable(msg.sender); | |
| function withdraw() public { | |
| if (msg.sender != owner) |
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
| // Collect funds in a payable `stake()` function and track individual `balances` with a mapping: | |
| // ( Make sure to add a `Stake(address,uint256)` event and emit) | |
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 DB { | |
| // 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2 //1 | |
| // 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db //2 | |
| // 0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB //3 |
NewerOlder