cairo-bootcamp-23's People
Forkers
manoahlinks estheroche vibenedict muheebyusufbaba1 enenche23 immanuelolivia1 collinsc1o 0xkyng saharnaz-ca utilitycoder joy-adah calebux oshioke-salaki tullisdebbi6 jeffreyjoelcairo-bootcamp-23's Issues
Issue in the transfer_from function in bwc_erc20_token contract
- The logic in the transfer_from function is flawed and was discovered while testing for edge cases using Starknet Foundry.
- In the function scope, the wrong arguments were passed into the spend_allowance token.
Initial Code for transfer_from function
fn transfer_from(
ref self: ContractState,
sender: ContractAddress,
recipient: ContractAddress,
amount: u256
) {
let caller = get_caller_address();
let my_allowance = self.allowances.read((sender, recipient));
assert(my_allowance <= amount, 'Amount Not Allowed');
self
.spend_allowance(
sender, caller, amount
); //responsible for deduction of the amount allowed to spend
self.transfer_helper(sender, recipient, amount);
}
Suggested corrections
- The my_allowance variable should be gotten from (sender,caller) tuple instead of (sender, recipient).
- The logic symbol in the assert function should be changed to >= because we are supposed to ensure that the amount to be spent be less than the approved allowance.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.