Skip to content

Instantly share code, notes, and snippets.

View Violet-Bora-Lee's full-sized avatar
๐Ÿ’œ
I code, build and act.

Bora Lee Violet-Bora-Lee

๐Ÿ’œ
I code, build and act.
View GitHub Profile
@Violet-Bora-Lee
Violet-Bora-Lee / curl.bash
Created March 26, 2024 12:09
bitfinity test token add
curl https://testnet.bitfinity.network \
-X POST -H 'content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"67","method":"ic_mintNativeToken","params":["0x629A54Cb82f9A300a67bB77477D747a1F19815Cf", "0x100"]}'
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract MoodDiary {
string mood;
function setMood(string memory _mood) public {
mood = _mood;
}
@Violet-Bora-Lee
Violet-Bora-Lee / wl_mapping.sol
Created October 4, 2023 02:21
์†”๋ฆฌ๋””ํ‹ฐ ๋งคํ•‘ ์—ฐ์Šต
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract Whitelist {
// ํ™”์ดํŠธ ๋ฆฌ์ŠคํŠธ์— ๋“ฑ๋ก๋œ ์‚ฌ๋žŒ์„ ๊ด€๋ฆฌํ•˜๋Š” ์šฉ๋„์˜ map์ž‘์„ฑ
// mapping ๋ณ€์ˆ˜ ์„ ์–ธ
// ํ™”์ดํŠธ ๋ฆฌ์ŠคํŠธ์— ํŠน์ • ์ฃผ์†Œ๋ฅผ ๋“ฑ๋ก์‹œํ‚ค๋Š” ํ•จ์ˆ˜ ์„ ์–ธ
}
@Violet-Bora-Lee
Violet-Bora-Lee / event_example.sol
Created October 3, 2023 14:10
์†”๋ฆฌ๋””ํ‹ฐ ์ด๋ฒคํŠธ ์˜ˆ์‹œ
pragma solidity ^0.8.0;
contract SimpleToken {
mapping(address => uint256) public balances;
// ํ† ํฐ ์ „์†ก ์ด๋ฒคํŠธ ์ •์˜
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
constructor(uint256 initialSupply) {
balances[msg.sender] = initialSupply;
@Violet-Bora-Lee
Violet-Bora-Lee / state_variable_example.sol
Last active October 3, 2023 14:06
์†”๋ฆฌ๋””ํ‹ฐ ์ƒํƒœ๋ณ€์ˆ˜ ์˜ˆ์‹œ
pragma solidity ^0.8.0;
contract SimpleToken {
// state ๋ณ€์ˆ˜๋กœ ๊ฐ ์ฃผ์†Œ์˜ ์ž”์•ก์„ ์ €์žฅ
mapping(address => uint256) public balances;
// ์ดˆ๊ธฐ ์ž”์•ก ์„ค์ •
constructor(uint256 initialSupply) {
balances[msg.sender] = initialSupply;
}
@Violet-Bora-Lee
Violet-Bora-Lee / event.sol
Last active October 3, 2023 18:58
์†”๋ฆฌ๋””ํ‹ฐ event ๊ธฐ๋ณธ ๋ฌธ๋ฒ•
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// ์ด๋ฒคํŠธ
// ๋ธ”๋ก์ฒด์ธ์— ๋กœ๊ทธ๋ฅผ ๋‚จ๊ธธ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ฌธ๋ฒ•(๊ฐ์ฒด)์ด๋‹ค.
// ํ”„๋ก ํŠธ์—”๋“œ ๋“ฑ์—์„œ ํŠน์ • ์ปจํŠธ๋ž™ํŠธ์— ๋Œ€ํ•œ ๋กœ๊ทธ๋ฅผ ํŒŒ์‹ฑํ•˜์—ฌ ์‘์šฉํ•˜๋ ค ํ•  ๋•Œ ์œ ์šฉํ•˜๋‹ค.
// ๋ธ”๋ก์ฒด์ธ ์ƒํƒœ๋ณ€์ˆ˜๋ณด๋‹ค ๋‚ฎ์€ ๋น„์šฉ์œผ๋กœ ์ •๋ณด๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋‹ค.
contract Events {
// sender ์ฃผ์†Œ์™€ ๋ฉ”์‹œ์ง€์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ž์—ด์„ ๊ธฐ๋กํ•  ์šฉ๋„์˜ ์ด๋ฒคํŠธ ์„ ์–ธ
@Violet-Bora-Lee
Violet-Bora-Lee / lw3_sophomore_solidity.sol
Last active June 8, 2025 12:37
Pocket Solidity by Bora Lee ์†”๋ฆฌ๋””ํ‹ฐ ๋ฌธ๋ฒ• ์ •๋ฆฌ, ์ด๋ณด๋ผ์˜ ํฌ์ผ“ ์†”๋ฆฌ๋””ํ‹ฐ
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// ๋งคํ•‘(Mapping)์€ ํ•ด์‹œ๋งต, ๊ฐ์ฑ„, ๋”•์…”๋„ˆ๋ฆฌ์ฒ˜๋Ÿผ ํ‚ค-๊ฐ’ ์Œ์ด ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.
contract Mapping {
// ์ฃผ์†Œ(ํ‚ค)์™€ uint(๊ฐ’)์Œ์„ ๋งคํ•‘ํ•จ
mapping(address => uint) public myMap;
function get(address _addr) public view returns (uint) {
// ๋งคํ•‘์€ ํ•ญ์ƒ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š”๋ฐ,
@Violet-Bora-Lee
Violet-Bora-Lee / myFirstDapp.html
Created March 30, 2023 08:05
LW3DAO-Freshmen-1
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My First dapp</title>
<script
src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"
type="application/javascript"
></script>
// in util.js
export function times(x) {
return x * x;
}
export function plusTwo(number) {
return number + 2;
}
// in app.js
import { times as multiplication, plusTwo as plus2 } from './util.js';
// in util.js
export default function times(x) {
return x * x;
}
// in app.js
import k from './util.js';
console.log(k(4)); // returns 16