Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Use semver without 'v' for the wallet version (#484)
Browse files Browse the repository at this point in the history
* Use semver without 'v' for the wallet version

* add Semver check for contract

* Ensure wallet version does not start with a v
  • Loading branch information
draganm authored Aug 5, 2019
1 parent c2d83a7 commit 87e9698
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build/wallet/DailyLimitTrait.bin

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/wallet/Wallet.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/wallet/combined.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/walletDeployer/DailyLimitTrait.bin

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/walletDeployer/Wallet.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/walletDeployer/WalletDeployer.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/walletDeployer/combined.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/wallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ contract Wallet is ENSResolvable, Vault, GasTopUpLimit, LoadLimit {
event ExecutedTransaction(address _destination, uint _value, bytes _data);
event UpdatedAvailableLimit();

string constant public WALLET_VERSION = "v2.0.0";
string constant public WALLET_VERSION = "2.0.0";
uint constant private _DEFAULT_MAX_STABLECOIN_LOAD_LIMIT = 10000; //10,000 USD

/// @dev Is the registered ENS node identifying the licence contract.
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/tokencard/contracts/v2

require (
github.com/Masterminds/semver v1.4.2
github.com/ethereum/go-ethereum v1.8.27
github.com/kr/pretty v0.1.0 // indirect
github.com/onsi/ginkgo v1.6.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/allegro/bigcache v1.1.1-0.20190116153254-84a0ff3f153c h1:JnxT952szw65TwPg7iz1iYVqEoikvX8mSkSgIhNr0Vo=
github.com/allegro/bigcache v1.1.1-0.20190116153254-84a0ff3f153c/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/aristanetworks/goarista v0.0.0-20180907105523-ff33da284e76 h1:64W/KrGykPTfDI9xTkZtnjZRYA5p2+c/IuGgjzeWCpI=
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/wallet.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/bindings/walletDeployer.go

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion test/wallet/wallet_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"
"fmt"
"os"
"strings"
"testing"

"github.com/Masterminds/semver"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -47,14 +49,27 @@ var _ = BeforeEach(func() {
})

var allPassed = true
var currentVersion = "v2.0.0"
var currentVersion = "2.0.0"

var _ = Describe("Wallet Version", func() {
It("should return the current version", func() {
v, err := Wallet.WALLETVERSION(nil)
Expect(err).ToNot(HaveOccurred())
Expect(v).To(Equal(currentVersion))
})

It("should be a Semver", func() {
v, err := Wallet.WALLETVERSION(nil)
Expect(err).ToNot(HaveOccurred())
_, err = semver.NewVersion(v)
Expect(err).ToNot(HaveOccurred())
})

It("should not start with a v prefix", func() {
v, err := Wallet.WALLETVERSION(nil)
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(v, "v")).To(BeFalse())
})
})

var _ = AfterEach(func() {
Expand Down

0 comments on commit 87e9698

Please sign in to comment.