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

US Treasury Auction Example #12

Closed
wants to merge 1 commit into from
Closed

Conversation

andytudhope
Copy link
Collaborator

This PR adds an example of how to run US Treasury Auctions on SUAVE.

There are still some parts of the contract to fix, and the main.go script to write once that has happened.


// Complete an auction and emit results
// Anyone can call this, as the creator sets the duration
// question: can/should it emit all bids for public verification?
Copy link
Contributor

Choose a reason for hiding this comment

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

It does not matter if you emit the bids, they are in the confidential store so they are not public. Normally, the pattern is to use the onchain callback to return the leak data of the bid that you want to expose.


func main() {
fr := framework.New()
fr.DeployContract("TAuction.sol/TAuction.json")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expand the example to also send the transactions?

uint256 currentTotal = totalData.length > 0 ? abi.decode(totalData, (uint256)) : 0;
uint256 newTotal = currentTotal + amount;
Suave.confidentialStore(bid.id, "tauction:v0:noncompetitivetotal", abi.encode(newTotal));
emit BidSubmitted(auctionId, bid.id);
Copy link
Contributor

Choose a reason for hiding this comment

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

In the current iteration, events cannot be emitted off-chain

}

Auction[] public auctions;
mapping(uint256 => Suave.BidId[]) private _bids;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used?

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.

2 participants