Skip to content
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

Merged
merged 12 commits into from
Oct 13, 2021
Merged

added tokens interface #7

merged 12 commits into from
Oct 13, 2021

Conversation

chescalante
Copy link
Contributor

No description provided.

@chescalante chescalante force-pushed the feature/US-264-tokens branch from 01afd67 to 1a26e57 Compare October 12, 2021 20:15
@chescalante chescalante marked this pull request as ready for review October 12, 2021 20:21
Copy link
Contributor

@ilanolkies ilanolkies left a 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

Copy link
Contributor

@ilanolkies ilanolkies left a 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/BaseToken.ts Outdated Show resolved Hide resolved
src/lib/token/BaseToken.ts Outdated Show resolved Hide resolved
src/lib/token/BaseToken.ts Outdated Show resolved Hide resolved
src/lib/token/ERC20Token.ts Outdated Show resolved Hide resolved
Comment on lines 41 to 57
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns:

  1. This is not consistent int units. One returns the real value and the other uses the blockchain value
  2. Is this working with decimals? I guess not...

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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.

package.json Outdated Show resolved Hide resolved
Christian Escalante and others added 2 commits October 12, 2021 22:47
Copy link
Contributor

@ilanolkies ilanolkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments

Comment on lines +4 to +8
export type { ERC20 } from "./ERC20";
export type { ERC677 } from "./ERC677";

export { ERC20__factory } from "./factories/ERC20__factory";
export { ERC677__factory } from "./factories/ERC677__factory";
Copy link
Contributor

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

Copy link
Contributor Author

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?

src/lib/token/RBTCToken.ts Outdated Show resolved Hide resolved
@ilanolkies ilanolkies added the lib Libraries and dependencies label Oct 13, 2021
@ilanolkies ilanolkies added this to the v1.0.0 milestone Oct 13, 2021
Copy link
Contributor

@ilanolkies ilanolkies left a 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

@ilanolkies ilanolkies merged commit 594e437 into main Oct 13, 2021
@jessgusclark jessgusclark deleted the feature/US-264-tokens branch May 16, 2022 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib Libraries and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants