From 0265558f130c36ee9d17afcba6bc01a63ef6a444 Mon Sep 17 00:00:00 2001 From: Blake <104744707+r3v4s@users.noreply.github.com> Date: Sat, 23 Sep 2023 04:57:28 +0900 Subject: [PATCH] chore: use std.PrevRealm() in grc721 package (#992) update (missing part of) grc721 package implementation to use `std.PrevRealm()` not `std.GetOrigCaller()` ## related #667 implementation of `std.PrevRealm()` #895 update grc20, 721 to use `std.PrevRealm()`
Checklists... ## Contributors Checklist - [x] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](../.benchmarks/README.md).
Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com> --- examples/gno.land/p/demo/grc/grc721/basic_nft.gno | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gno.land/p/demo/grc/grc721/basic_nft.gno b/examples/gno.land/p/demo/grc/grc721/basic_nft.gno index cbce05d379c..b707527c6a4 100644 --- a/examples/gno.land/p/demo/grc/grc721/basic_nft.gno +++ b/examples/gno.land/p/demo/grc/grc721/basic_nft.gno @@ -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 } @@ -123,7 +123,7 @@ 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) } @@ -131,7 +131,7 @@ func (s *basicNFT) SetApprovalForAll(operator std.Address, approved bool) error // 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 } @@ -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 }