infinite
Description¶
Infinite respect.
nc infinite.chal.crewc.tf 60001
Solution¶
-
To solve the challenge, we need to store more than 50 respect tokens in the
fancyStore
contract -
The
respectToken
andcandyToken
contracts do not contain any significant information, as they are simple ERC20 token contracts that allow the owner to call themint()
andburn()
functions -
The
crewToken
contract with amint()
function that can only be called once is the entry point -
Next, we can exchange 1 crew token for 10 candies
-
The candy tokens can be exchanged for respect tokens through
fancyStore.sellCandies()
orlocalGang.gainRespect()
. But these two functions have a slight difference. ThesellCandies()
function burns candy tokens and transfers the respect tokens stored in the contract to the msg.sender, while thegainRespect()
function transfers the candy tokens from the msg.sender and mint respect tokens to msg.sender. Thus, the total supply of respect tokens can be increased throughgainRespect()
. Similarly, we can increase the total supply of candy tokens throughfancyStore.buyCandies()
- Starting with 10 candy tokens, we can first exchange them for 10 respect tokens and increase
candyCount
throughlocalGang.gainRespect()
. Then, buy 10 candies and increaserespectCount
throughfancyStore.buyCandies()
. At this point, we have obtained an additional 10 candies and transferred 10 respect tokens to thefancyStore
contract XD Repeat these steps untilSTORE.respectCount(CREW.receiver())
reaches the desired threshold
Script¶
Flag¶
crew{inf1nt3_c4n9i3s_1nfinit3_r3s9ect}