WTF-Solidity icon indicating copy to clipboard operation
WTF-Solidity copied to clipboard

update getAuctionPrice, auctionMint, readme

Open 0xc25fee20 opened this issue 3 years ago • 4 comments

去除部分冗余

0xc25fee20 avatar Oct 14 '22 17:10 0xc25fee20

这个不算冗余其实 如果多次引用一个状态变量 最好把它赋值给一个临时变量 可以省gas

AmazingAng avatar Oct 14 '22 17:10 AmazingAng

之前的getAuctionPrice写法与实时价格计算有点出入,有个拍卖起始时间的状态变量直接取就行,没必要单独填入时间参数。

0xc25fee20 avatar Oct 14 '22 18:10 0xc25fee20

嗯 getAuctionPrice()函数的确可以把参数省略掉,但是其他的地方不需要改。你更新下pr吧。

AmazingAng avatar Oct 15 '22 07:10 AmazingAng

确实,在函数中赋值local变量省了大概1.5%的gas,这个改回来了

0xc25fee20 avatar Oct 15 '22 15:10 0xc25fee20