Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@beandao/factorieth

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beandao/factorieth

Factorieth Smart Contract Integration Library

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Factori.eth

๋งŽ์€ ์ปจํŠธ๋ž™ํŠธ๋“ค์„ ์ž‘์€ ์ฝ”๋“œ ํฌ๊ธฐ๋กœ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๋ชจ๋“  ๋ฐฐํฌ๋œ ์ปจํŠธ๋ž™ํŠธ๊ฐ€ ๊ณตํ†ต๋œ ์ฝ”๋“œ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ „์ฒด ๋ธ”๋ก์ฒด์ธ์˜ ํฌ๊ธฐ๋ฅผ ์ค„์—ฌ์ค๋‹ˆ๋‹ค.

Deployed

Goerli

  • StandardToken: 0x6403f288483cA9DA7409515967577042070628FE
    • Template key: 0x254a2c8cf5790bce7b67ebee0b9248872894f42c48f15178f58ed5fd9df1b244
    • Beacon key: 0x4a11e43cfddd716c15df4ee2923729a06a73946b6910e2b2afaba3ac715a0ff1
  • Allowlist: 0xdFa76fDF338B1d7518A83392ec3989Ed26DE3b1C
  • FactoryV1: 0xd91b593eeeada81dc7f6a20e4d8140ef5adf598a

FactoryV1์„ ํ†ตํ•ด์„œ ํ† ํฐ์„ ๋ฐฐํฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ž‘์—…์„ ํ•„์š”๋กœ ํ•ฉ๋‹ˆ๋‹ค.

const ABI = [
    'function initialize(string memory contractVersion, string memory tokenName, string memory tokenSymbol, uint8 tokenDecimals)',
    'function mintTo(address to, uint256 value)',
    'function transferOwnership(address newOwner)',
];
const interfaces = new ethers.utils.Interface(ABI);

// ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ๋ฒ„์ „
const contractVersion = '1';
// ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์ด๋ฆ„
const tokenName = 'TESTToken';
// ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์‹ฌ๋ณผ
const tokenSymbol = 'TT';
// ํ† ํฐ์˜ ์†Œ์ˆ˜์  ์ž๋ฆฌ
const tokenDecimals = ethers.BigNumber.from('18');
// ์†Œ์ˆ˜์  ์ž๋ฆฌ๋ฅผ ํฌํ•จํ•˜์—ฌ ํ† ํฐ์„ ์ฒ˜์Œ ๋ฐฐํฌํ•  ์ˆซ์ž๋Š” ๋‹ค์Œ์ด ๋ฉ๋‹ˆ๋‹ค. 100.000000000000000000
const initialToken = ethers.BigNumber.from('100000000000000000000');

// ํ† ํฐ์„ ๋ฐฐํฌํ•˜๋ฉด์„œ ์ดˆ๊ธฐํ™” ํ•  ๋•Œ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ง๋ ฌํ™” ํ•ฉ๋‹ˆ๋‹ค.
const initdata = interfaces.encodeFunctionData('initialize', [contractVersion, tokenName, tokenSymbol, tokenDecimals]);

// ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ๋ฅผ ๋ฐฐํฌํ•  ๋•Œ ํ† ํฐ์„ ์ˆ˜๋ นํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
// ํ•ด๋‹น ์ž‘์—…์œผ๋กœ, ํ† ํฐ ์ˆ˜๋Ÿ‰์ด ๊ฒฐ์ •๋˜๊ณ  ์ด ๊ณต๊ธ‰๋Ÿ‰์ด ์—…๋ฐ์ดํŠธ ๋ฉ๋‹ˆ๋‹ค.
const mintCallData = interfaces.encodeFunctionData('mintTo', [
    'ํ† ํฐ ์ˆ˜๋ น์ธ์˜ ์ด๋”๋ฆฌ์›€ ์ฃผ์†Œ',
    initialToken,
]);

// ๋ฐฐํฌ๋œ ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์†Œ์œ ๊ถŒ ์ด์ „(์ด ์ž‘์—…์ด ์—†๋‹ค๋ฉด, ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์†Œ์œ ๊ถŒ์€ factory๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค)
// ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์†Œ์œ ๊ถŒ์ด ์žˆ๋‹ค๋ฉด ์ถ”ํ›„์— ํ† ํฐ์„ ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ ์†Œ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
const ownerCallData = interfaces.encodeFunctionData('transferOwnership', [
    'ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ์†Œ์œ ๊ถŒ์„ ๊ฐ€์งˆ ์ด๋”๋ฆฌ์›€ ์ฃผ์†Œ',
]);

//...

// factory์—์„œ ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ ํ…œํ”Œ๋ฆฟ ํ‚ค๋ฅผ ๋„ฃ๊ณ , ์ดˆ๊ธฐํ™” ๋ฐ์ดํ„ฐ, ๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ ํ•„์š”ํ•œ ํ˜ธ์ถœ์„ ๋ฐฐ์—ดํ˜•ํƒœ๋กœ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.
await Factory.deploy('0x7a215e0493b6f77cc3450eb1693d035a56f9cefea78454efef7eddf34488c323', initdata, [
    mintCallData,
    ownerCallData,
]);
// tx๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ์ปจํŠธ๋ž™ํŠธ๊ฐ€ ๋ฐฐํฌ๋˜๋ฉฐ, ํ† ํฐ์„ ์ƒ์„ฑํ•˜๊ณ  ์˜ค๋„ˆ์‹ญ์„ ๋„˜๊ธฐ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Keywords

FAQs

Package last updated on 17 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc