@@ -18,6 +18,7 @@ import (
1818
1919type Prototype struct {
2020 contract bind.Contract
21+ revision string
2122}
2223
2324func NewPrototype (client * thorclient.Client ) (* Prototype , error ) {
@@ -30,14 +31,22 @@ func NewPrototype(client *thorclient.Client) (*Prototype, error) {
3031 }, nil
3132}
3233
34+ // Revision creates a new Prototype instance with the specified revision.
35+ func (p * Prototype ) Revision (rev string ) * Prototype {
36+ return & Prototype {
37+ contract : p .contract ,
38+ revision : rev ,
39+ }
40+ }
41+
3342func (p * Prototype ) Raw () bind.Contract {
3443 return p .contract
3544}
3645
3746// Master returns the master address for the given contract
3847func (p * Prototype ) Master (contract thor.Address ) (thor.Address , error ) {
3948 out := new (common.Address )
40- if err := p .contract .Method ("master" , contract ).Call ().ExecuteInto (& out ); err != nil {
49+ if err := p .contract .Method ("master" , contract ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
4150 return thor.Address {}, err
4251 }
4352 return thor .Address (* out ), nil
@@ -51,7 +60,7 @@ func (p *Prototype) SetMaster(self thor.Address, newMaster thor.Address) bind.Me
5160// IsUser checks if the given address is a user of the contract
5261func (p * Prototype ) IsUser (self thor.Address , user thor.Address ) (bool , error ) {
5362 out := new (bool )
54- if err := p .contract .Method ("isUser" , self , user ).Call ().ExecuteInto (& out ); err != nil {
63+ if err := p .contract .Method ("isUser" , self , user ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
5564 return false , err
5665 }
5766 return * out , nil
@@ -70,7 +79,7 @@ func (p *Prototype) RemoveUser(self thor.Address, user thor.Address) bind.Method
7079// UserCredit returns the credit amount for a specific user
7180func (p * Prototype ) UserCredit (self thor.Address , user thor.Address ) (* big.Int , error ) {
7281 out := new (big.Int )
73- if err := p .contract .Method ("userCredit" , self , user ).Call ().ExecuteInto (& out ); err != nil {
82+ if err := p .contract .Method ("userCredit" , self , user ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
7483 return nil , err
7584 }
7685 return out , nil
@@ -81,7 +90,7 @@ func (p *Prototype) CreditPlan(self thor.Address) (*big.Int, *big.Int, error) {
8190 var out = [2 ]any {}
8291 out [0 ] = new (* big.Int )
8392 out [1 ] = new (* big.Int )
84- if err := p .contract .Method ("creditPlan" , self ).Call ().ExecuteInto (& out ); err != nil {
93+ if err := p .contract .Method ("creditPlan" , self ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
8594 return nil , nil , err
8695 }
8796 return * (out [0 ].(* * big.Int )), * (out [1 ].(* * big.Int )), nil
@@ -95,7 +104,7 @@ func (p *Prototype) SetCreditPlan(self thor.Address, credit *big.Int, recoveryRa
95104// CurrentSponsor returns the current sponsor address
96105func (p * Prototype ) CurrentSponsor (self thor.Address ) (thor.Address , error ) {
97106 out := new (common.Address )
98- if err := p .contract .Method ("currentSponsor" , self ).Call ().ExecuteInto (& out ); err != nil {
107+ if err := p .contract .Method ("currentSponsor" , self ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
99108 return thor.Address {}, err
100109 }
101110 return thor .Address (* out ), nil
@@ -104,7 +113,7 @@ func (p *Prototype) CurrentSponsor(self thor.Address) (thor.Address, error) {
104113// IsSponsor checks if the given address is a sponsor
105114func (p * Prototype ) IsSponsor (self thor.Address , sponsor thor.Address ) (bool , error ) {
106115 out := new (bool )
107- if err := p .contract .Method ("isSponsor" , self , sponsor ).Call ().ExecuteInto (& out ); err != nil {
116+ if err := p .contract .Method ("isSponsor" , self , sponsor ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
108117 return false , err
109118 }
110119 return * out , nil
@@ -128,7 +137,7 @@ func (p *Prototype) Unsponsor(self thor.Address) bind.MethodBuilder {
128137// Balance returns the balance at a specific block number
129138func (p * Prototype ) Balance (self thor.Address , blockNumber * big.Int ) (* big.Int , error ) {
130139 out := new (big.Int )
131- if err := p .contract .Method ("balance" , self , blockNumber ).Call ().ExecuteInto (& out ); err != nil {
140+ if err := p .contract .Method ("balance" , self , blockNumber ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
132141 return nil , err
133142 }
134143 return out , nil
@@ -137,7 +146,7 @@ func (p *Prototype) Balance(self thor.Address, blockNumber *big.Int) (*big.Int,
137146// Energy returns the energy at a specific block number
138147func (p * Prototype ) Energy (self thor.Address , blockNumber * big.Int ) (* big.Int , error ) {
139148 out := new (big.Int )
140- if err := p .contract .Method ("energy" , self , blockNumber ).Call ().ExecuteInto (& out ); err != nil {
149+ if err := p .contract .Method ("energy" , self , blockNumber ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
141150 return nil , err
142151 }
143152 return out , nil
@@ -146,7 +155,7 @@ func (p *Prototype) Energy(self thor.Address, blockNumber *big.Int) (*big.Int, e
146155// HasCode checks if the contract has code
147156func (p * Prototype ) HasCode (self thor.Address ) (bool , error ) {
148157 out := new (bool )
149- if err := p .contract .Method ("hasCode" , self ).Call ().ExecuteInto (& out ); err != nil {
158+ if err := p .contract .Method ("hasCode" , self ).Call ().AtRevision ( p . revision ). ExecuteInto (& out ); err != nil {
150159 return false , err
151160 }
152161 return * out , nil
@@ -155,7 +164,7 @@ func (p *Prototype) HasCode(self thor.Address) (bool, error) {
155164// StorageFor returns the storage value for a given key
156165func (p * Prototype ) StorageFor (self thor.Address , key thor.Bytes32 ) (thor.Bytes32 , error ) {
157166 out := new (common.Hash )
158- if err := p .contract .Method ("storageFor" , self , key ).Call ().ExecuteInto (out ); err != nil {
167+ if err := p .contract .Method ("storageFor" , self , key ).Call ().AtRevision ( p . revision ). ExecuteInto (out ); err != nil {
159168 return thor.Bytes32 {}, err
160169 }
161170 return thor .Bytes32 (* out ), nil
0 commit comments