
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
contract2object
Advanced tools
스마트 계약의 ABI와 [UPPERCASE의 OOP 기능](https://github.com/Hanul/UPPERCASE/blob/master/DOC/GUIDE/OOP.md)을 이용하여 스마트 계약을 JavaScript 객체로 만들어 줍니다.
스마트 계약의 ABI와 UPPERCASE의 OOP 기능을 이용하여 스마트 계약을 JavaScript 객체로 만들어 줍니다.
프로젝트의 DEPENDENCY
파일에 Hanul/Contract2Object
를 추가합니다.
Contract2Object는 UPPERCASE-CORE-COMMON에 의존적입니다. 따라서 UPPERCASE-CORE/COMMON.js 코드가 필요합니다.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="UPPERCASE-CORE/COMMON.js"></script>
<script src="Contract2Object.js"></script>
<!-- main.js에 코드 입력 -->
<script src="main.js"></script>
<script>INIT_OBJECTS();</script>
</body>
</html>
npm install contract2object
require('contract2object');
SomeContract = OBJECT({
preset : () => {
return Contract2Object;
},
...
SomeContract = OBJECT({
preset : () => {
return Contract2Object;
},
params : () => {
return {
abi : [{"constant":true,"inputs":...,
address : '0x031Fa6bE087416386ab6b85fE97A0856164821c2'
};
}
});
예를 들어 스마트 계약에 다음과 같은 함수가 있다면,
function balanceOf(address user) external view returns (uint256 balance) {
return balances[user];
}
다음과 같이 JavaScript 함수로 사용할 수 있습니다.
SomeContract.balancOf(user, (balance) => {
...
});
너무 큰 숫자의 경우 JavaScript의 숫자 타입으로는 범위가 벗어나는 경우가 있으므로, 이를 방지하고자 숫자의 경우 다음과 같이 문자열로도 반환합니다.
SomeContract.balancOf(user, (balance, balanceStr) => {
...
});
트랜잭션을 기다려야 하는 함수의 경우 트랜잭션이 끝나고 콜백이 실행됩니다.
SomeContract.approve({
spender : spender,
amount : amount
}, () => {
...
});
만약 트랜잭션 주소를 가져와야 하는 경우에는 다음과 같이 콜백을 2개 지정합니다.
SomeContract.approve({
spender : spender,
amount : amount
}, {
transactionAddress : (address) => {
...
},
success : () => {
...
}
});
payable
함수를 실행하는 경우에는 파라미터에 ether
를 추가할 수 있습니다.
SomeContract.buy({
ether : 12,
amount : amount
}, () => {
...
});
FAQs
스마트 계약의 ABI와 [UPPERCASE의 OOP 기능](https://github.com/Hanul/UPPERCASE/blob/master/DOC/GUIDE/OOP.md)을 이용하여 스마트 계약을 JavaScript 객체로 만들어 줍니다.
The npm package contract2object receives a total of 0 weekly downloads. As such, contract2object popularity was classified as not popular.
We found that contract2object 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.