When granting an allowance to a user, only the token amount is specified, not the stem
. However, during a transferDeposit
operation, the recipient has the option to include the stem
. This allows the recipient to access the sender's grown stalks linked to older deposits (with a lower stem), leading to the transfer of a greater quantity of grown stalks to the recipient.
Suppose Alice has deposited 1000e6
beans in season 1.
In season 1001 (after 1000 hours), Alice deposits another 500e6
beans.
In this season, Alice gives an allowance of 500e6
to Bob.
Bob notices that Alice had a deposit in season 1, so the amount of grown stalks associated with that deposit is much higher than the grown stalks associated with the deposit in season 1001.
Bob calls transferDeposit
with the following parameters:
sender
: Alice
recipient
: Bob
token
: BEAN
stem
: stem at season 1 instead of 1001
amount
: 500e6
As a result, a deposit of 500e6
beans will be transferred to Bob. Additionally, all the grown stalks associated with the 500e6
deposit from season 1 will also be transferred to Bob.
While, if Bob used the stem
from season 1001 as the stem
parameter in the transferDeposit
function, no grown stalks would be allocated to him, since no stalks have yet grown from Alice's second deposit.
The following test implements the scenario explained above. It shows that the grown stalks allocated to Bob is 6000000000000
which is decreased from Alice's.
The output is:
The recipient of a transferDeposit
can take the large amount of grown stalks from the sender that is not expected by the sender.
It is recommended that when transferDeposit
is called to transfer from the sender to the recipient, the function should automatically review all of the sender's deposits and select the most recent ones that have a sufficient amount (greater than or equal to the transferring amount). This way, the deposit with the fewest associated grown stalks will be used for the deduction, resulting in fewer grown stalks being transferred from the sender to the recipient.
The person receiving the allowance could specify the stem of a more valuable deposit, thing that might not be intended by the person giving the allowance.
The person receiving the allowance could specify the stem of a more valuable deposit, thing that might not be intended by the person giving the allowance.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.