找到约 14 条结果

文章 如何更改已部署智能合约的字节码

...这些测试,我们使用了[这篇文章](https://kndrck.co/posts/local_erc20_bal_mani_w_hh/)作为示例。首先,你需要通过npm或yarn安装hardhat > 2.4.0。接下来,你必须将要更改的智能合约代码的副本添加到项目存储库中。在我们开始讨论代码之前,...

文章 零知识证明-Mixer(混币)应用分析

...,发送方需要Deposit(存入)**固定数量**的代币(ETH或者ERC20代币)。Deposit同时要求发送方生成Semaphore对应的Identity。也就是说,每“混”一笔交易,发送方需要创建一个Identity。 ### Mix Mix接口实现”提钱“的功能。Mix接口由...

文章 雪绒花互操作性活动回顾

...EL 和 CL 规范流程如何收敛(并可能[从其他 EIP 中分离出 ERC](https://ethereum-magicians.org/t/proposal-forking-ercs-from-eips-repository/12804)),启动了一个新的 [Verkle Trie 测试网](https://kaustinen.ethdevops.io/),提出了一个 [SSZ 编码 EL 交易](https://notes...

文章 如何在 MetaMask 中添加 GetBlock RPC 端点

...兴趣,请随时尝试在以太坊的测试网中创建你的第一个[ERC-20 token](https://learnblockchain.cn/article/20879/)。 请继续关注GetBlock的更多指南。 >- 原文链接: [getblock.io/blog/how-to-...](https://getblock.io/blog/how-to-add-getblock-endpoints-to-metamask) >- 登...

文章 Balancer DeFi 协议架构的安全分析

...件。 - 内部化 BPT 管理:在 V3 中,Vault 本身充当多代币 ERC20 合约,管理所有 Balancer 池代币 (BPT)。这确保了对池的基础代币余额及其 BPT 供应的更新以原子方式进行,从而缓解了一类只读重入攻击向量。 - 原生利率和小数位数缩...

文章 compound v2 v3 对比

...Note: Pre-transfer hook can re-enter buyCollateral with a stale collateral ERC20 balance. // This is a problem if quoteCollateral derives its discount from the collateral ERC20 balance. withdrawCollateral(address(this), recipient, asset, safe128(collateralAmount)); ...

文章 Michael.W基于Foundry精读Openzeppelin第5期——Counters.sol

...重置操作。一般用该库可以追踪一个mapping中元素个数,ERC721的token id和统计请求次数等。 ### 1. 目标合约 封装Counters library成为一个可调用合约: Github: https://github.com/RevelationOfTuring/foundry-openzeppelin-contracts/blob/master/src/utils/Moc...

文章 Viem:轻量级以太坊开发工具库

...3a2206206994597c13d831ec7', //usdt合约地址 abi: contractABI, // eg: erc20 abi functionName: 'balanceOf', args: [accountAddress] }) console.log('代币余额:', balance) ``` ## 从 Ethers v5 迁移 ### Provider 迁移到 Client: ```typescript // Ethers 写法 const provid...

文章 零碎的Solidity小Tip

...执行线程。 使用try...catch...,下面举个例子,安全转账ERC20。 ```js contract B is ERC20{ function transferFrom(address _sender, address _to, uint _amount) public returns (bool){ //... } } contract A{ function interactWithToken(uint _amount){ ...

文章 如何使用x402支付协议实现加密货币付费墙

...免手续费的 USDC 结算。 ### x402 支付流程 x402 协议利用 [ERC-3009](https://eips.ethereum.org/EIPS/eip-3009) `TransferWithAuthorization` 标准来实现无 Gas 费用转账,这是无摩擦 Web3 货币化的关键组成部分。让我们介绍一下使用 x402 的流程以及符合...

文章 每周以太坊进展 2020/11/08

...一个 NFT 中获得随机数](https://blog.chain.link/random-numbers-nft-erc721/) * [BitQuery 对比自身与 TheGraph](https://bitquery.io/blog/thegraph-and-bitquery) * [通过阅读 GasToken 代码来理解 EVM](https://learnblockchain.cn/article/1707) ## 安全性 * [PercentFinance 的 b...

文章 Foundry 高级作弊码系列:第 7 部分 - Foundry 中的不变性测试

...机的交易(调用)序列,以尝试违反这些不变量。例如,ERC20 不变量可能是“totalSupply == 所有余额的总和”或“没有人可以凭空创建代币”。然后,Foundry 将进行随机调用(并 fuzz 输入),并在每次调用后检查这些条件。 > "不...

文章 Web3-Js: ethereumjs-tx发送签名交易

...transfer('0x198b2feE780F944F4b9D80e87C59AAe5ee8460bd',1000).encodeABI(), //ERC20转账 } const tx = new EthereumTx(txParams) tx.sign(privateKey) const serializedTx = tx.serialize() web3.eth.sendSignedTransaction('0x' + serializedTx.toStri...

文章 如何在Uniswap V3中添加新的池子

...s, uint24, uint160) ) "000000000000000000000000" + evilToken.address.toLowerCase().substring(2) + // token1 地址 "000000000000000000000000" + WETH.address.toLowerCase().substring(2) + // token2 地址 "00000000000000000000000000000000000000000000000000000000000001f4" + // 费用 "000000000000...