
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@beandao/factorieth
Advanced tools
자주 사용되는 컨트랙트들을 작은 코드 크기로 배포할 수 있으며, 모든 배포된 컨트랙트가 공통된 코드베이스를 사용하기 때문에 전체 블록체인의 크기를 줄이는데 기여합니다.
FactoryV1을 통해서 토큰을 배포하기 위해서는 다음과 같은 작업을 필요로 합니다.
const ABI = [
'function initialize(bytes calldata data)',
'function mintTo(address to, uint256 value)',
'function transferOwnership(address newOwner)',
];
const interfaces = new ethers.utils.Interface(ABI);
// 토큰 컨트랙트의 이름
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', [
ethers.utils.defaultAbiCoder.encode(['string', 'string', 'uint8'], [tokenName, tokenSymbol, tokenDecimals]),
]);
// 토큰 컨트랙트를 배포할 때 토큰을 수령하도록 합니다.
// 해당 작업으로, 토큰 수량이 결정되고 총 공급량이 업데이트 됩니다.
const mintCallData = interfaces.encodeFunctionData('mintTo', [
'토큰 수령인의 이더리움 주소',
initialToken,
]);
// 배포된 토큰 컨트랙트의 소유권 이전(이 작업이 없다면, 토큰 컨트랙트의 소유권은 factory가 가지고 있습니다)
// 토큰 컨트랙트의 소유권이 있다면 추후에 토큰을 생성하거나 소각할 수 있습니다.
const ownerCallData = interfaces.encodeFunctionData('transferOwnership', [
'토큰 컨트랙트의 소유권을 가질 이더리움 주소',
]);
const Factory = await ethers.getContractAt(FACTORY_ABI, FACTORY_ADDRESS);
// factory에서 토큰 컨트랙트의 템플릿 키를 넣고, 초기화 데이터, 그리고 각각 필요한 호출을 배열형태로 넣어줍니다.
await Factory['deploy(bool,bytes32,bytes,bytes[])'](
false,
TOKEN_KEY,
initdata,
[mintCallData, ownerCallData],
{ value: ethers.utils.parseEther('0.01') },
);
// tx가 완료되면 토큰 컨트랙트가 배포되어 토큰을 발행하고 Factory가 가지고 있던 오너십을 넘기게 됩니다.
FAQs
Factorieth Smart Contract Integration Library
We found that @beandao/factorieth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.