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

chore: use std.PrevRealm() in grc721 package #992

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/gno.land/p/demo/grc/grc721/basic_nft.gno
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s *basicNFT) Approve(to std.Address, tid TokenID) error {
return ErrApprovalToCurrentOwner
}

caller := std.GetOrigCaller()
caller := std.PrevRealm().Addr()
if caller != owner && !s.IsApprovedForAll(owner, caller) {
return ErrCallerIsNotOwnerOrApproved
}
Expand Down Expand Up @@ -123,15 +123,15 @@ func (s *basicNFT) SetApprovalForAll(operator std.Address, approved bool) error
return ErrInvalidAddress
}

caller := std.GetOrigCaller()
caller := std.PrevRealm().Addr()
return s.setApprovalForAll(caller, operator, approved)
}

// Safely transfers `tokenId` token from `from` to `to`, checking that
// contract recipients are aware of the GRC721 protocol to prevent
// tokens from being forever locked.
func (s *basicNFT) SafeTransferFrom(from, to std.Address, tid TokenID) error {
caller := std.GetOrigCaller()
caller := std.PrevRealm().Addr()
if !s.isApprovedOrOwner(caller, tid) {
return ErrCallerIsNotOwnerOrApproved
}
Expand All @@ -150,7 +150,7 @@ func (s *basicNFT) SafeTransferFrom(from, to std.Address, tid TokenID) error {

// Transfers `tokenId` token from `from` to `to`.
func (s *basicNFT) TransferFrom(from, to std.Address, tid TokenID) error {
caller := std.GetOrigCaller()
caller := std.PrevRealm().Addr()
if !s.isApprovedOrOwner(caller, tid) {
return ErrCallerIsNotOwnerOrApproved
}
Expand Down
Loading