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

refactor!(zoe): add method zcf.getInstance() #3353

Merged
merged 2 commits into from
Jun 18, 2021
Merged

Conversation

katelynsills
Copy link
Contributor

Closes #3330

Adds a method to zcf: getInstance(). This allows the contract code to easily get its own instance, in order to send elsewhere.

Comment on lines +76 to +77
makeIssuerRecord(currencyKit.brand, currencyKit.issuer, {
assetKind: AssetKind.NAT,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the brace moved. It looks like the signature for makeIsuserRecord() is still

 * @param {Brand} brand
 * @param {Issuer} issuer
 * @param {DisplayInfo=} displayInfo
 * @returns {IssuerRecord}

@@ -121,7 +128,8 @@ test('makeInstanceRecordStorage', async t => {
// Add currency again, but call it "money"
addIssuerToInstanceRecord(
'Money',
makeIssuerRecord(currencyKit.brand, currencyKit.issuer, AssetKind.NAT, {
makeIssuerRecord(currencyKit.brand, currencyKit.issuer, {
Copy link
Contributor

Choose a reason for hiding this comment

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

The brace here moved, too. I think the braces should surround decimalPlaces to make a displayInfo, and assetKind should be a separate third argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you think so? The types were telling me that assetKind should be a part of displayInfo, which is the third argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind. I was reading the body of makeIssuerRecord() (in issuerRecord.js) and thought I was looking at the parameter list.

I was only looking at the def'n because AssetKind.NAT moved from being the third param to being a part of the third param. Was the code previously broken? Why didn't tsc catch it before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tsc doesn't cover the tests yet in Zoe

@@ -121,7 +128,8 @@ test('makeInstanceRecordStorage', async t => {
// Add currency again, but call it "money"
addIssuerToInstanceRecord(
'Money',
makeIssuerRecord(currencyKit.brand, currencyKit.issuer, AssetKind.NAT, {
makeIssuerRecord(currencyKit.brand, currencyKit.issuer, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind. I was reading the body of makeIssuerRecord() (in issuerRecord.js) and thought I was looking at the parameter list.

I was only looking at the def'n because AssetKind.NAT moved from being the third param to being a part of the third param. Was the code previously broken? Why didn't tsc catch it before?

@katelynsills katelynsills enabled auto-merge (squash) June 18, 2021 16:55
@katelynsills katelynsills merged commit d8952c2 into master Jun 18, 2021
@katelynsills katelynsills deleted the 3330-getInstance branch June 18, 2021 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zoe: make the contract instance available within a contract
2 participants