-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added tokens interface #7
Conversation
01afd67
to
1a26e57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s remove approval
logic for now since we are not going to use it yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful!!
src/lib/token/ERC20Token.ts
Outdated
public async balance(): Promise<BigNumber> { | ||
const account = await this.account() | ||
|
||
const decimals = await this.decimals() | ||
|
||
const balance = await this.tokenContract.balanceOf(account) | ||
|
||
return balance.div(tenPow(decimals)) | ||
} | ||
|
||
public async transfer( | ||
recipientAddress: string, | ||
amount: BigNumberish, | ||
options?: ITransferOptions, | ||
): Promise<ContractTransaction> { | ||
return this.tokenContract.transfer(recipientAddress, amount, { | ||
...options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some concerns:
- This is not consistent int units. One returns the real value and the other uses the blockchain value
- Is this working with decimals? I guess not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure about that but I test it and it doesn't work, so I made a few changes to remove the div I believe we don't need that for now. Let me know what you think about it.
TokenType, | ||
} from './BaseToken' | ||
|
||
class RBTCToken extends BaseToken implements IToken { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I are only working with testnet now. Let's add TRBTC
too. I guess it is a different entity, maybe inherits all the same but overriding the symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few changes regarding this, let me know if it's ok for now.
Co-authored-by: Ilan <[email protected]>
Co-authored-by: Ilan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more comments
export type { ERC20 } from "./ERC20"; | ||
export type { ERC677 } from "./ERC677"; | ||
|
||
export { ERC20__factory } from "./factories/ERC20__factory"; | ||
export { ERC677__factory } from "./factories/ERC677__factory"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these auto-generated? Should we ignore them? And, why ERC677? We are using just ERC20 methods for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was auto generated, but I made a copy from other project because I think this won't change, it makes sense to you? do you prefer to be auto generated with typechain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I love it
No description provided.