mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Pass tokenAddress to AuctionClient constructor
This commit is contained in:
@@ -1068,7 +1068,7 @@ func (c *Client) AuctionGetDefaultSlotSetBid(slotSet uint8) (*big.Int, error) {
|
||||
// }
|
||||
|
||||
// AuctionBid is the interface to call the smart contract function
|
||||
func (c *Client) AuctionBid(slot int64, bidAmount *big.Int, forger, tokenAddress ethCommon.Address) (tx *types.Transaction, err error) {
|
||||
func (c *Client) AuctionBid(slot int64, bidAmount *big.Int, forger ethCommon.Address) (tx *types.Transaction, err error) {
|
||||
c.rw.Lock()
|
||||
defer c.rw.Unlock()
|
||||
cpy := c.nextBlock().copy()
|
||||
@@ -1117,7 +1117,7 @@ func (c *Client) AuctionBid(slot int64, bidAmount *big.Int, forger, tokenAddress
|
||||
}
|
||||
|
||||
// AuctionMultiBid is the interface to call the smart contract function
|
||||
func (c *Client) AuctionMultiBid(startingSlot int64, endingSlot int64, slotSet [6]bool, maxBid, closedMinBid, budget *big.Int, forger, tokenAddress ethCommon.Address) (tx *types.Transaction, err error) {
|
||||
func (c *Client) AuctionMultiBid(startingSlot int64, endingSlot int64, slotSet [6]bool, maxBid, closedMinBid, budget *big.Int, forger ethCommon.Address) (tx *types.Transaction, err error) {
|
||||
c.rw.Lock()
|
||||
defer c.rw.Unlock()
|
||||
cpy := c.nextBlock().copy()
|
||||
|
||||
@@ -68,7 +68,6 @@ func TestClientAuction(t *testing.T) {
|
||||
addrWithdraw := ethCommon.HexToAddress("0x6b175474e89094c44da98b954eedeac495271d0f")
|
||||
addrForge := ethCommon.HexToAddress("0xCfAA413eEb796f328620a3630Ae39124cabcEa92")
|
||||
addrForge2 := ethCommon.HexToAddress("0x1fCb4ac309428feCc61B1C8cA5823C15A5e1a800")
|
||||
token1Addr := ethCommon.HexToAddress("0x6b175474e89094c44da98b954eedeac495271d0f")
|
||||
|
||||
var timer timer
|
||||
clientSetup := NewClientSetupExample()
|
||||
@@ -81,33 +80,33 @@ func TestClientAuction(t *testing.T) {
|
||||
|
||||
// Check several cases in which bid doesn't succed, and also do 2 successful bids.
|
||||
|
||||
_, err := c.AuctionBid(0, big.NewInt(1), addrForge, token1Addr)
|
||||
_, err := c.AuctionBid(0, big.NewInt(1), addrForge)
|
||||
assert.Equal(t, errBidClosed, err)
|
||||
|
||||
_, err = c.AuctionBid(4322, big.NewInt(1), addrForge, token1Addr)
|
||||
_, err = c.AuctionBid(4322, big.NewInt(1), addrForge)
|
||||
assert.Equal(t, errBidNotOpen, err)
|
||||
|
||||
// 101 % 6 = 5; defaultSlotSetBid[5] = 1500; 1500 + 10% = 1650
|
||||
_, err = c.AuctionBid(101, big.NewInt(1650), addrForge, token1Addr)
|
||||
_, err = c.AuctionBid(101, big.NewInt(1650), addrForge)
|
||||
assert.Equal(t, errCoordNotReg, err)
|
||||
|
||||
_, err = c.AuctionRegisterCoordinator(addrForge, "https://foo.bar")
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = c.AuctionBid(3, big.NewInt(1), addrForge, token1Addr)
|
||||
_, err = c.AuctionBid(3, big.NewInt(1), addrForge)
|
||||
assert.Equal(t, errBidBelowMin, err)
|
||||
|
||||
_, err = c.AuctionBid(3, big.NewInt(1650), addrForge, token1Addr)
|
||||
_, err = c.AuctionBid(3, big.NewInt(1650), addrForge)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = c.AuctionRegisterCoordinator(addrForge2, "https://foo2.bar")
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = c.AuctionBid(3, big.NewInt(16), addrForge2, token1Addr)
|
||||
_, err = c.AuctionBid(3, big.NewInt(16), addrForge2)
|
||||
assert.Equal(t, errBidBelowMin, err)
|
||||
|
||||
// 1650 + 10% = 1815
|
||||
_, err = c.AuctionBid(3, big.NewInt(1815), addrForge2, token1Addr)
|
||||
_, err = c.AuctionBid(3, big.NewInt(1815), addrForge2)
|
||||
assert.Nil(t, err)
|
||||
|
||||
c.CtlMineBlock()
|
||||
|
||||
Reference in New Issue
Block a user