Closed ipromise2324 closed 9 months ago
Link to #2
Thanks to @ipromise2324 for finding the bug of forgetting to raise new prices when the Wind message is sent. This bug is fixed in a7c63a3. PTAL.
Currently there are 6 tests related to Wind
failed, but i cannot figure out the reason. @ipromise2324 PTAL.
Currently there are 6 tests related to
Wind
failed, but i cannot figure out the reason. @ipromise2324 PTAL.
I've seen the issue and will promptly investigate the 6 failed tests to identify the cause. I'll update on progress ASAP.
Currently there are 6 tests related to
Wind
failed, but i cannot figure out the reason. @ipromise2324 PTAL.I've seen the issue and will promptly investigate the 6 failed tests to identify the cause. I'll update on progress ASAP.
I've identified two issues.
The first is that let standardRefundAmount: Int = ((ctx.value - STORAGE_FEE) - ctx.readForwardFee());
doesn't subtract the DEPLOY_FEE
.
The second issue is the use of nativeReserve(msg.preserveBaseAssetAmount, 0);
, but when the Alarm contract sends the Chime message
, it doesn't return the needBaseAssetAmount
of Ton, only sending back the refundBaseAssetAmount
.
After addressing the two issues mentioned above, all testcases can now be passed successfully.
Code I changed:
receive(msg: JettonTransferNotification)
, I added asendBackAmount
variable to record how much money needs to be returned to the user after building alarm successfully. Also, I changed the mode toSendIgnoreErrors
and set thevalue
tosendBackAmount
in thereceive(msg: JettonTransferNotification)
.receive(msg: JettonTransferNotification)
,needBaseAssetAmount = msg.amount.float() / baseAssetPrice;
After calculation, it needs to be multiplied by10**9
to represent the amount of ton to be transferred (e.g., 10/2.5 = 4, which means 4 tons, therefore 4 should be multiplied by Decimal)requireNotInitialized
toself.watchmaker == newAddress(0, 0)
. This means that ifwatchmaker.address == 0x00
, it indicates that the alarm has not been initialized yet (originally it was judged byself.oracleAddress == newAddress(0, 0)
).receive(msg: Reset)
function, I changed therequire(self.remainScale > msg.buyNum, "Not enough scale to buy");
to>=
, to allow the Timekeeper to buy all of theremainScale
.receive(msg: JettonTransferNotification)
function, withinif(opCode == 1)
, theReset
message's sender ismsg.sender
(timekeeper), notctx.sender
(oracle jetton wallet).receive(msg: Chime)
function, when deploying a new alarm, a basicvalue
is required to build the contract. I have currently hardcoded it as 0.05 ton.receive(msg: Chime)
function, after building the alarm,totalAlarms
is not incremented by 1.Code need to be revised:
receive(msg: JettonTransferNotification)
function of the Oracle contract, code for returning Jettons to the user was not written.receive(msg: Reset)
function,baseAssetPrice
is not overwritten with a new value. It should be changed to the new price as perceived by the timekeeper. Currently, it is 0, so thebaseAssetPrice
for the new alarm built by the timekeeper is also 0.receive(msg: Chime)
function, in addition to checking ifmsg.remainScale > 0
, should there also be a check to see if the verification stage has passed? Only if it has passed, the price can be changed.receive(msg: Reset)
, ifrequire(self.remainScale >= msg.buyNum, "Not enough scale to buy")
is not met, the jettons are not returned to the timekeeper.