github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/reference/stdlibs/std/coin.md (about)

     1  ---
     2  id: coin
     3  ---
     4  
     5  # Coin
     6  View concept page [here](../../../concepts/stdlibs/coin.md).
     7  
     8  ```go
     9  type Coin struct {
    10  	Denom  string `json:"denom"`
    11  	Amount int64  `json:"amount"`
    12  }
    13  func (c Coin) String() string {...}
    14  func (c Coin) IsGTE(other Coin) bool {...}
    15  ```
    16  
    17  ## String
    18  Returns a string representation of the `Coin` it was called upon.
    19  
    20  #### Usage
    21  ```go
    22  coin := std.Coin{"ugnot", 100} 
    23  coin.String() // 100ugnot
    24  ```
    25  ---
    26  ## IsGTE
    27  Checks if the amount of `other` Coin is greater or equal than amount of Coin `c` it was called upon.
    28  If coins compared are not of the same denomination, `IsGTE` will panic.
    29  
    30  #### Parameters
    31  - `other` **Coin** to compare with
    32  
    33  #### Usage
    34  ```go
    35  coin1 := std.Coin{"ugnot", 150}
    36  coin2 := std.Coin{"ugnot", 100}
    37  
    38  coin1.IsGTE(coin2) // true
    39  coin2.IsGTE(coin1) // false
    40  ```