github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/assets/how-to-guides/porting-solidity-to-gno/porting-8.gno (about)

     1  func Withdraw() {
     2  	// Query the return amount to non-highest bidders
     3  	amount, _ := pendingReturns.Get(std.GetOrigCaller().String())
     4  
     5  	if amount > 0 {
     6  		// If there's an amount, reset the amount first,
     7  		pendingReturns.Set(std.GetOrigCaller().String(), 0)
     8  
     9  		// Return the exceeded amount
    10  		banker := std.GetBanker(std.BankerTypeRealmSend)
    11  		pkgAddr := std.GetOrigPkgAddr()
    12  
    13  		banker.SendCoins(pkgAddr, std.GetOrigCaller(), std.Coins{{"ugnot", amount.(int64)}})
    14  	}
    15  }