![](/img/trans.png)
[英]In Brownie, is there a way to define a constant in one place and use it in both a Vyper smart contract and a test script?
我正在尋找諸如環境變量或#define 之類的東西,其中常量值在編譯之前被替換到智能合約中。 我仔細閱讀了 Brownie 文檔並沒有發現任何東西,但這似乎是應該存在的。 ...
[英]In Brownie, is there a way to define a constant in one place and use it in both a Vyper smart contract and a test script?
我正在尋找諸如環境變量或#define 之類的東西,其中常量值在編譯之前被替換到智能合約中。 我仔細閱讀了 Brownie 文檔並沒有發現任何東西,但這似乎是應該存在的。 ...
[英]Vyper how to convert uint256 to String?
我需要在 vyper 中將 uint256 轉換為字符串,我注意到 Solidity 上有類似的東西(取自OpenSea 的文檔): 有一個名為“Strings.uint2str()”的方法,在 Vyper 中是否有等效的方法? ...
[英]Do I need to use approve method in ERC721?
我正在練習智能合約,NFT 看起來對我很感興趣。 用 Vyper 編寫的 ERC721 它的批准機制是什么? isApprovedForAll是做什么的? 海事組織。 我不需要使用批准方法。 我只使用transferFrom()就足夠了。 如果我錯了請糾正我 ...
[英]Is there a way in vyper to calculate e^x with x being a signed decimal?
在我的論文中,我一直在尋找使用 Vyper 智能合約計算 exp(x) 的方程式。 我選擇 Vyper 而不是 Solidity,因為它能夠處理定點數。 但是,我找不到有效的方法來執行此操作,因為 Vyper 不允許我使用十進制底數進行冪運算。 我試圖做的是 e**x (e = 常數歐拉數 = 約 ...
[英]Problems installing cytoolz on Python@3.10
我正在嘗試在virtualenv中安裝cytoolz : Python版本 = 3.10.0 Pip版本 = 21.3.1 在激活的 virtualenv 中運行pip install cytoolz后,我得到以下日志: 似乎是安裝cytoolz package 有問題。運行pip instal ...
[英]How to test payable/external method with waffle and ethers.js
這是用 vyper 編寫的要測試的智能合約 用 waffle 和 ethers.js 測試智能合約的donate()方法的正確方法是什么? 是否有 ethers.js 的 sendTransaction 方法,可以像web3+truffle這個例子一樣在合約端調用? ...
[英]StateAccessViolation: Value must be a literal - Vyper Ethereum smart contract
版本信息 vyper 版本( vyper --version的輸出):0.2.8+commit.069936f 操作系統:osx Python 版本( python --version的輸出):Python 2.7.16 環境( pip freeze的輸出): 這個for循環的調用: 拋出錯誤: ...
[英]A security issue with require(send()) in Solidity
我正在開發一個基於區塊鏈的 uni 項目,我必須審核我們的系統,檢查已知攻擊等。 這是我檢查的文件,主要是因為我首先開始處理智能合約問題: 已知攻擊以太坊智能合約我無法理解“Dos With (unexpected) revert attack”部分中使用的示例。 我分享代碼: 他們說,攻擊者可以強 ...
[英]Solidity & Truffle - Automatic test case generate in Solidity and JavaScript, What is the best option? Props and Cons?
我創建了新的 ERC-20 令牌,現在想要添加測試代碼。 有沒有辦法在 SOL 文件中自動生成測試用例? 也想知道在Truffle JavaScript框架中自動生成測試代碼的方式。 我已經用谷歌搜索並獲得了一些有用的庫,但它不是自動生成的代碼。 (如mocha或chai )請幫助我。 謝謝 ...
[英]How to de/encode bytes into an address array in Vyper?
我正在嘗試在 Vyper https://developers.aave.com/#implementing-a-flashloanreceiver-contract 中實現 Aave 閃貸接收器,我需要將一個地址數組作為“字節內存_params”參數傳遞給它。 任何想法如何在 web3 中將地址數 ...
[英]Create new contracts from a contract Vyper
有沒有辦法從合同中創建任何子合同,例如當有人調用“createChildContract()”函數時。 在solidity,單純用new算子賣的問題,vyper呢? 非常感謝 ! ...
[英]Vyper Equivalent for solidity's address(this)
如何在 Vyper 中獲取當前合約的地址。 在solidity中使用address(this) 。 Vyper 中的等價物是什么。 ...
[英]Pay a user's gas: Ethereum
我需要一些幫助。 我正在開發一個智能合約,該合約將允許用戶保存字符串(映射(地址=>字符串))。 唯一的問題是,我希望合同為用戶節省汽油費以支付字符串費用。 關於如何的任何想法 ...
[英]Vyper: compatible to write/deploy Ethereum classic smart-contract with python?
由於Vitalik認為 Python Serpent Compiler已過時且不安全 ( 本次審核及此處也確認),因此更建議使用Vyper編譯器從python編寫/部署以太坊智能合約 。 可以肯定的是Vyper可以在以太坊去中心化平台上工作 ,但是我想知道Vyper是否也兼容在以太坊經典去 ...